kui-vue 3.2.10 → 3.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/components/_tool/number.js +177 -0
  2. package/components/_tool/utils.js +9 -3
  3. package/components/base/input.jsx +82 -54
  4. package/components/base/pop.jsx +22 -8
  5. package/components/button/button.jsx +1 -1
  6. package/components/button/styles/index.less +6 -2
  7. package/components/checkbox/checkbox.jsx +6 -11
  8. package/components/checkbox/demo/check-all.md +6 -6
  9. package/components/checkbox/group.jsx +0 -1
  10. package/components/checkbox/styles/index.less +17 -11
  11. package/components/divider/styles/index.less +1 -1
  12. package/components/dropdown/demo/rightmenu.md +2 -2
  13. package/components/dropdown/styles/index.less +23 -34
  14. package/components/form/demo/base.md +7 -1
  15. package/components/form/demo/valid.md +13 -4
  16. package/components/form/styles/index.less +1 -5
  17. package/components/icon/demo/base.md +2 -2
  18. package/components/icon/demo/search.vue +31 -14
  19. package/components/icon/icon.jsx +3 -1
  20. package/components/icon/styles/index.less +1 -1
  21. package/components/index.js +2 -0
  22. package/components/input/demo/icon.md +2 -2
  23. package/components/input/demo/size.md +3 -3
  24. package/components/input/demo/suffix.md +13 -6
  25. package/components/input/demo/theme.md +11 -6
  26. package/components/input/index.md +2 -1
  27. package/components/input/input.jsx +5 -0
  28. package/components/input/styles/index.less +52 -63
  29. package/components/inputNumber/demo/base.md +34 -0
  30. package/components/inputNumber/demo/ffix.md +27 -0
  31. package/components/inputNumber/demo/format.md +80 -0
  32. package/components/inputNumber/demo/index.vue +23 -0
  33. package/components/inputNumber/demo/info.md +7 -0
  34. package/components/inputNumber/demo/size.md +18 -0
  35. package/components/inputNumber/index.js +2 -0
  36. package/components/inputNumber/index.md +16 -0
  37. package/components/inputNumber/inputNumber.jsx +169 -0
  38. package/components/inputNumber/styles/index.less +172 -0
  39. package/components/menu/demo/collapsed.md +1 -1
  40. package/components/menu/styles/dropmenu.less +2 -2
  41. package/components/menu/styles/index.less +31 -14
  42. package/components/message/demo/icon.md +33 -0
  43. package/components/message/demo/index.vue +2 -0
  44. package/components/message/index.md +9 -7
  45. package/components/message/inner.jsx +5 -3
  46. package/components/modal/modal.jsx +31 -31
  47. package/components/notice/demo/icon.md +27 -11
  48. package/components/notice/demo/index.vue +2 -0
  49. package/components/notice/demo/types.md +28 -0
  50. package/components/notice/index.js +3 -0
  51. package/components/notice/index.md +8 -6
  52. package/components/popconfirm/styles/index.less +64 -83
  53. package/components/poptip/demo/base.md +7 -0
  54. package/components/poptip/demo/placement.md +12 -13
  55. package/components/poptip/styles/index.less +60 -79
  56. package/components/progress/demo/circle.md +2 -2
  57. package/components/radio/button.jsx +4 -2
  58. package/components/radio/demo/button.md +32 -28
  59. package/components/radio/group.jsx +4 -2
  60. package/components/radio/radio.jsx +7 -7
  61. package/components/radio/styles/index.less +61 -29
  62. package/components/rate/demo/base.md +7 -1
  63. package/components/rate/rate.jsx +8 -3
  64. package/components/rate/star.jsx +4 -3
  65. package/components/rate/styles/index.less +5 -3
  66. package/components/select/select.jsx +2 -0
  67. package/components/skeleton/demo/custom.md +62 -0
  68. package/components/skeleton/demo/index.vue +2 -0
  69. package/components/skeleton/demo/items.md +6 -2
  70. package/components/skeleton/index.md +32 -12
  71. package/components/skeleton/skeleton.jsx +1 -3
  72. package/components/skeleton/skeletonAvatar.jsx +33 -7
  73. package/components/skeleton/skeletonButton.jsx +29 -4
  74. package/components/skeleton/skeletonImage.jsx +43 -6
  75. package/components/skeleton/skeletonText.jsx +29 -4
  76. package/components/slider/demo/base.md +7 -15
  77. package/components/slider/demo/formatter.md +19 -0
  78. package/components/slider/demo/index.vue +10 -1
  79. package/components/slider/demo/marks.md +42 -0
  80. package/components/slider/demo/reverse.md +26 -0
  81. package/components/slider/demo/vertical.md +26 -3
  82. package/components/slider/demo/withNumber.md +43 -0
  83. package/components/slider/index.md +15 -6
  84. package/components/slider/slider.jsx +173 -41
  85. package/components/slider/styles/index.less +109 -44
  86. package/components/slider/thumb.jsx +165 -0
  87. package/components/space/demo/align.md +22 -21
  88. package/components/space/demo/base.md +0 -1
  89. package/components/space/demo/index.vue +2 -0
  90. package/components/space/demo/size.md +34 -22
  91. package/components/space/demo/vertical.md +1 -1
  92. package/components/space/demo/wrap.md +12 -0
  93. package/components/space/index.md +6 -5
  94. package/components/space/space.jsx +40 -35
  95. package/components/space/styles/index.less +15 -0
  96. package/components/spin/demo/mode.md +6 -4
  97. package/components/spin/spin.jsx +1 -1
  98. package/components/styles/index.less +1 -0
  99. package/components/switch/demo/loading.md +1 -1
  100. package/components/switch/demo/text.md +3 -1
  101. package/components/switch/styles/index.less +31 -20
  102. package/components/table/styles/index.less +9 -10
  103. package/components/tooltip/styles/index.less +103 -76
  104. package/components/tooltip/tooltip.jsx +3 -0
  105. package/components/upload/styles/index.less +7 -0
  106. package/components/upload/upload.jsx +22 -12
  107. package/dist/k-ui.css +2 -2
  108. package/dist/k-ui.js +2 -2
  109. package/package.json +1 -1
@@ -0,0 +1,172 @@
1
+ @import '../../styles/var.less';
2
+ .k-input-number {
3
+ position: relative;
4
+ display: inline-flex;
5
+ width: 100%;
6
+ max-width: 100%;
7
+ color: var(--kui-color-font);
8
+ align-items: center;
9
+ border: 1px solid var(--kui-color-border);
10
+ border-radius: var(--kui-border-radius);
11
+ transition: all .3s ease-in-out;
12
+ box-sizing: border-box;
13
+ gap: 8px;
14
+ padding: 0 8px;
15
+ &:hover {
16
+ border-color: var(--kui-color-main);
17
+ }
18
+ .k-input-number-controls {
19
+ width: 20px;
20
+ display: flex;
21
+ flex-direction: column;
22
+ color: var(--kui-color-icon);
23
+ border-left: 1px solid var(--kui-color-border);
24
+ font-size: 11px;
25
+ justify-content: center;
26
+ align-items: center;
27
+ height: 32px;
28
+ margin-right: -8px;
29
+ }
30
+ .k-input-number-control {
31
+ flex: 1;
32
+ display: flex;
33
+ width: 100%;
34
+ align-items: center;
35
+ justify-content: center;
36
+ cursor: pointer;
37
+ &:hover {
38
+ color: var(--kui-color-main);
39
+ background-color: var(--kui-color-gray-80);
40
+ }
41
+ &:last-child {
42
+ border-top: 1px solid var(--kui-color-border);
43
+ }
44
+ }
45
+ .k-input-number-text {
46
+ padding-left: 0;
47
+ border: none;
48
+ height: 32px;
49
+ line-height: 1.5;
50
+ padding: 4px 0;
51
+ font-size: 14px;
52
+ color: var(--kui-color-font);
53
+ background-color: transparent;
54
+ background-image: none;
55
+ box-sizing: border-box;
56
+ flex: 1;
57
+ min-width: 10px;
58
+ &::placeholder {
59
+ color: var(--kui-color-disable-color);
60
+ }
61
+ &:focus {
62
+ // box-shadow: 0 0 5px var(--kui-color-main-30);
63
+ border-color: var(--kui-color-main);
64
+ outline: none;
65
+ }
66
+ }
67
+ &.k-input-number-focus {
68
+ border-color: var(--kui-color-main);
69
+ box-shadow: 0 0 5px var(--kui-color-main-30);
70
+ }
71
+ .k-input-number-suffix, .k-input-number-prefix {
72
+ font-size: 12px;
73
+ white-space: nowrap;
74
+ line-height: 1;
75
+ cursor: pointer;
76
+ user-select: none;
77
+ transition: all .2s ease-in-out;
78
+ display: flex;
79
+ &:hover {
80
+ color: var(--kui-color-font);
81
+ }
82
+ .k-icon {
83
+ font-size: 16px;
84
+ transition: all .2s ease-in-out;
85
+ color: var(--kui-color-icon);
86
+ }
87
+ }
88
+ .k-input-number-icon {
89
+ font-size: 16px;
90
+ color: var(--kui-color-icon);
91
+ }
92
+ }
93
+
94
+ .k-input-number-clearable {
95
+ cursor: pointer;
96
+ font-size: 15px;
97
+ color: var(--kui-color-gray);
98
+ &:hover {
99
+ color: var(--kui-color-font);
100
+ }
101
+ }
102
+
103
+ .k-input-number-sm {
104
+ gap: 6px;
105
+ .k-input-number-controls {
106
+ height: 24px;
107
+ }
108
+ .k-input-number-text {
109
+ padding: 2px 0;
110
+ height: 24px;
111
+ line-height: 22px;
112
+ }
113
+ .k-input-number-clearable {
114
+ font-size: 14px;
115
+ }
116
+ .k-input-number-icon {
117
+ font-size: 16px;
118
+ }
119
+ .k-input-number-suffix {
120
+ .k-icon {
121
+ font-size: 12px;
122
+ }
123
+ }
124
+ }
125
+
126
+ .k-input-number-lg {
127
+ .k-input-number-controls {
128
+ height: 40px;
129
+ }
130
+ .k-input-number-text {
131
+ padding: 2px 0;
132
+ height: 40px;
133
+ line-height: 38px;
134
+ font-size: 14px;
135
+ }
136
+ .k-input-number-clearable {
137
+ font-size: 18px;
138
+ }
139
+ .k-input-number-icon {
140
+ font-size: 25px;
141
+ }
142
+ .k-input-number-suffix {
143
+ .k-icon {
144
+ font-size: 18px;
145
+ }
146
+ }
147
+ }
148
+
149
+ .k-input-number-light {
150
+ border: none;
151
+ background-color: var(--kui-color-gray-80);
152
+ &:focus, &.k-input-number-focus {
153
+ box-shadow: none;
154
+ }
155
+ }
156
+
157
+ .k-input-number-disabled {
158
+ cursor: not-allowed;
159
+ color: var(--kui-color-disable-color);
160
+ background: var(--kui-color-disable-back);
161
+ border-color: var(--kui-color-disable-border);
162
+ &:hover {
163
+ border-color: var(--kui-color-disable-border);
164
+ }
165
+ & * {
166
+ cursor: not-allowed;
167
+ }
168
+ .k-input-number-control:hover {
169
+ background: 0 0;
170
+ color: var(--kui-color-icon);
171
+ }
172
+ }
@@ -10,7 +10,7 @@
10
10
  <br/>
11
11
  <br/>
12
12
  <Menu v-model="current" :open-keys="openKeys" theme="dark" :inline-collapsed="!collapsed" mode="inline">
13
- <MenuItem key="1-1" icon="mail">Option 1<span>sss</span></MenuItem>
13
+ <MenuItem key="1-1" icon="mail">Option 1</MenuItem>
14
14
  <MenuItem key="1-2" icon="calendar"><span>Option 2</span></MenuItem>
15
15
  <SubMenu key="sub2" icon="bar-chart" title="Navigation Two">
16
16
  <MenuItem key="2-1">Option 5</MenuItem>
@@ -27,7 +27,7 @@
27
27
  // margin-right: 8px;
28
28
  display: none;
29
29
  }
30
- .k-dropdown-menu-item, .k-dropdown-menu-submenu {
30
+ .k-dropdown-menu-item, .k-dropdown-menu-submenu .k-dropdown-menu-submenu-title {
31
31
  line-height: 1;
32
32
  font-size: 14px;
33
33
  list-style: none;
@@ -79,7 +79,7 @@
79
79
  left: 100%;
80
80
  }
81
81
  .k-dropdown-menu-submenu {
82
- padding-right: 36px;
82
+ // padding-right: 36px;
83
83
  position: relative;
84
84
  .k-dropdown-menu-submenu-arrow {
85
85
  position: absolute;
@@ -13,6 +13,7 @@
13
13
  color: var(--kui-color-font);
14
14
  // transition: background-color .3s cubic-bezier(.645, .045, .355, 1), width .3s cubic-bezier(.645, .045, .355, 1);
15
15
  transition: width .3s cubic-bezier(.645, .045, .355, 1);
16
+ user-select: none;
16
17
  ol, ul, li {
17
18
  list-style: none !important;
18
19
  margin: 0;
@@ -33,6 +34,7 @@
33
34
  width: 20px;
34
35
  height: 20px;
35
36
  margin-right: 8px;
37
+ flex-shrink: 0;
36
38
  }
37
39
  .k-menu-item-icon, .k-menu-submenu-inner .k-icon {
38
40
  margin-right: 8px;
@@ -51,12 +53,12 @@
51
53
  height: 14px;
52
54
  text-indent: 0;
53
55
  }
54
- .k-icon {
55
- &+span {
56
- opacity: 1;
57
- transition: all .3s cubic-bezier(.645, .045, .355, 1), width .3s cubic-bezier(.645, .045, .355, 1);
58
- }
59
- }
56
+ // .k-icon {
57
+ // &+span {
58
+ // opacity: 1;
59
+ // transition: all .3s cubic-bezier(.645, .045, .355, 1), width .3s cubic-bezier(.645, .045, .355, 1);
60
+ // }
61
+ // }
60
62
  &-item, .k-menu-submenu-title {
61
63
  cursor: pointer;
62
64
  overflow: hidden;
@@ -94,7 +96,7 @@
94
96
  color: var(--kui-color-disable-color);
95
97
  cursor: not-allowed;
96
98
  }
97
- .k-menu-submenu-inner{
99
+ .k-menu-submenu-inner {
98
100
  display: flex;
99
101
  align-items: center;
100
102
  }
@@ -121,7 +123,6 @@
121
123
  list-style: none;
122
124
  margin: 0;
123
125
  padding: 0;
124
-
125
126
  }
126
127
  .k-menu-item {
127
128
  padding: 10px 12px;
@@ -162,6 +163,10 @@
162
163
  }
163
164
  .k-menu-submenu-title {
164
165
  padding: 10px 36px 10px 12px;
166
+ height: 40px;
167
+ box-sizing: border-box;
168
+ display: flex;
169
+ align-items: center;
165
170
  position: relative;
166
171
  margin: 0 8px 8px 8px;
167
172
  border-radius: var(--kui-border-radius);
@@ -178,6 +183,8 @@
178
183
  }
179
184
  .k-menu-submenu-popup {
180
185
  transition: all 0.3s cubic-bezier(.215, .61, .355, 1);
186
+ overflow: hidden;
187
+ position: static;
181
188
  .k-menu {
182
189
  // background-color: var(--kui-color-gray-90);
183
190
  }
@@ -279,8 +286,8 @@
279
286
  white-space: nowrap;
280
287
  font-size: 0;
281
288
  line-height: 1;
282
- .k-menu-icon-temp{
283
- display: none;
289
+ .k-menu-icon-temp {
290
+ display: none;
284
291
  }
285
292
  >.k-menu-item, >.k-menu-submenu {
286
293
  line-height: 1;
@@ -359,7 +366,7 @@
359
366
  padding: 10px 12px;
360
367
  .k-icon {
361
368
  // font-size: 16px;
362
- margin-right: 0;
369
+ // margin-right: 0;
363
370
  }
364
371
  }
365
372
  &>.k-menu-submenu>.k-menu-submenu-title>.k-menu-submenu-arrow {
@@ -367,9 +374,10 @@
367
374
  }
368
375
  .k-icon {
369
376
  &+span {
370
- width: 0;
377
+ // width: 0;
371
378
  opacity: 0;
372
- display: inline-block;
379
+ // display: inline-block;
380
+ animation: toa .3s;
373
381
  }
374
382
  }
375
383
  }
@@ -378,7 +386,16 @@
378
386
  }
379
387
  }
380
388
 
381
- .k-menu-submenu-popup-content {
389
+ @keyframes toa {
390
+ from {
391
+ opacity: 1;
392
+ }
393
+ to {
394
+ opacity: 0;
395
+ }
396
+ }
397
+
398
+ .k-menu-submenu-popup {
382
399
  position: absolute;
383
400
  z-index: 1001;
384
401
  >.k-menu-submenu-popup {
@@ -0,0 +1,33 @@
1
+ <cn>
2
+ #### 自定图标
3
+ 自定图标。
4
+ </cn>
5
+
6
+ ```vue
7
+ <template>
8
+ <div>
9
+ <Button @click="alipay" icon="logo-alipay"></Button>
10
+ <Button @click="wechat" icon="logo-wechat"></Button>
11
+ </div>
12
+ </template>
13
+ <script>
14
+ let count = 0
15
+ export default{
16
+ methods:{
17
+ alipay() {
18
+ this.$Message.config({
19
+ icon:'logo-alipay',
20
+ content:"支付宝到账100万"
21
+ });
22
+ },
23
+ wechat() {
24
+ this.$Message.config({
25
+ color:'green',
26
+ icon:'logo-wechat',
27
+ content:"微信收款100万"
28
+ });
29
+ },
30
+ }
31
+ }
32
+ </script>
33
+ ```
@@ -1,6 +1,7 @@
1
1
  <script>
2
2
  import Info from './info'
3
3
  import Base from './base'
4
+ import Icon from './icon'
4
5
  import Types from './types'
5
6
  import Close from './close'
6
7
  import CN from '../index.md'
@@ -10,6 +11,7 @@ export default {
10
11
  <div>
11
12
  <Info class="typo" />
12
13
  <Base />
14
+ <Icon />
13
15
  <Types />
14
16
  <Close />
15
17
  <CN class="typo"/>
@@ -18,10 +18,12 @@
18
18
 
19
19
  参数 `options` 为对象,具体说明如下:
20
20
 
21
- | 属性 | 说明 | 类型 | 默认值 |
22
- |----------|---------------------------------------------------|----------|-------|
23
- | type | 提示类型,提供 `info`、`success`、`error`、`warning` 四种可选类型 | String | info |
24
- | content | 提示内容 | String | - |
25
- | duration | 自动关闭的延时,单位秒,0为 不自动关闭 | Number | 3 |
26
- | closable | 是否可手动关闭 | Boolean | false |
27
- | close | 关闭时的回调 | Function | - |
21
+ | 属性 | 说明 | 类型 | 默认值 |
22
+ | -------- | ----------------------------------------------------------------- | ------------ | ------ |
23
+ | type | 提示类型,提供 `info`、`success`、`error`、`warning` 四种可选类型 | String | info |
24
+ | content | 提示内容 | String,Vnode | - |
25
+ | duration | 自动关闭的延时,单位秒,0为 不自动关闭 | Number | 3 |
26
+ | closable | 是否可手动关闭 | Boolean | false |
27
+ | close | 关闭时的回调 | Function | - |
28
+ | icon | 自定义图标 | String | - |
29
+ | color | 自定义图标颜色 | String | - |
@@ -4,13 +4,15 @@ export default {
4
4
  type: { type: String, default: "info" },
5
5
  title: String,
6
6
  name: String,
7
- content: String,
7
+ content: [String, Object],
8
+ icon: String,
9
+ color: String,
8
10
  closable: Boolean,
9
11
  noticeType: { type: String, default: "message" },
10
12
  onClose: { type: Function, default: () => { } }
11
13
  },
12
14
  render() {
13
- let { noticeType, type, content, title, onClose, closable } = this
15
+ let { noticeType, type, content, title, onClose, closable, icon, color } = this
14
16
  const classes = [`k-${noticeType}-box`, `k-${noticeType}-${type}`, {
15
17
  'k-notice-has-icon': noticeType == 'notice' && type != 'default'
16
18
  }];
@@ -21,7 +23,7 @@ export default {
21
23
  success: "checkmark-circle",
22
24
  warning: "alert-circle"
23
25
  };
24
- let iconNode = type != 'default' ? <Icon type={icons[type]} class={`k-${noticeType}-icon`} /> : null
26
+ let iconNode = type != 'default' ? <Icon type={icon || icons[type]} color={color} class={`k-${noticeType}-icon`} /> : null
25
27
  if (noticeType == 'message') {
26
28
 
27
29
  childNode = (
@@ -63,37 +63,37 @@ export default {
63
63
  this.showInner = false
64
64
  }, 300);
65
65
  }
66
- this.resetBodyStyle(visible)
67
- },
68
- resetBodyStyle(opened) {
69
- if (!this.$isServer) {
70
- let target = document.body;
71
- if (!this.show && !cacheBodyOverflow.hasOwnProperty('overflow')) {
72
- cacheBodyOverflow = {
73
- width: target.style.width,
74
- overflow: target.style.overflow,
75
- overflowX: target.style.overflowX,
76
- overflowY: target.style.overflowY,
77
- }
78
- }
79
- if (opened) {
80
- let barWidth = measureScrollBar(true)
81
- let hasBar = target.scrollHeight > window.innerHeight || target.offsetHeight > window.innerHeight
82
- if (barWidth && hasBar) {
83
- target.style.width = `calc(100% - ${barWidth}px)`
84
- target.style.overflow = `hidden`
85
- }
86
- } else {
87
- setTimeout(() => {
88
- let task = (this.tasks && this.tasks.length == 0) || !this.tasks
89
- task && Object.keys(cacheBodyOverflow).forEach(key => {
90
- target.style[key] = cacheBodyOverflow[key] || ''
91
- delete cacheBodyOverflow[key]
92
- })
93
- }, 300)
94
- }
95
- }
66
+ // this.resetBodyStyle(visible)
96
67
  },
68
+ // resetBodyStyle(opened) {
69
+ // if (!this.$isServer) {
70
+ // let target = document.body;
71
+ // if (!this.show && !cacheBodyOverflow.hasOwnProperty('overflow')) {
72
+ // cacheBodyOverflow = {
73
+ // width: target.style.width,
74
+ // overflow: target.style.overflow,
75
+ // overflowX: target.style.overflowX,
76
+ // overflowY: target.style.overflowY,
77
+ // }
78
+ // }
79
+ // if (opened) {
80
+ // let barWidth = measureScrollBar(true)
81
+ // let hasBar = target.scrollHeight > window.innerHeight || target.offsetHeight > window.innerHeight
82
+ // if (barWidth && hasBar) {
83
+ // target.style.width = `calc(100% - ${barWidth}px)`
84
+ // target.style.overflow = `hidden`
85
+ // }
86
+ // } else {
87
+ // setTimeout(() => {
88
+ // let task = (this.tasks && this.tasks.length == 0) || !this.tasks
89
+ // task && Object.keys(cacheBodyOverflow).forEach(key => {
90
+ // target.style[key] = cacheBodyOverflow[key] || ''
91
+ // delete cacheBodyOverflow[key]
92
+ // })
93
+ // }, 300)
94
+ // }
95
+ // }
96
+ // },
97
97
  setPos() {
98
98
  if (this.show && this.$refs.modal) {
99
99
  let { showPoint: { x, y } } = this
@@ -153,7 +153,7 @@ export default {
153
153
  },
154
154
  beforeDestroy() {
155
155
  !this.$isServer && document.removeEventListener('mousedown', this.mousedown);
156
- this.resetBodyStyle(false)
156
+ // this.resetBodyStyle(false)
157
157
  },
158
158
 
159
159
  mounted() {
@@ -1,25 +1,41 @@
1
1
  <cn>
2
- #### 带图标的提醒
3
- 通过调用不同的方法,可展示不同的类型
2
+ #### 自定义图标
3
+ 自定义图标
4
4
  </cn>
5
5
 
6
6
  ```vue
7
7
  <template>
8
8
  <div>
9
- <Button @click="notice('info')" type="primary">消息提示 </Button>
10
- <Button @click="notice('warning')">警告提示 </Button>
11
- <Button @click="notice('success')">成功提示 </Button>
12
- <Button @click="notice('error')" type="danger">错误提示 </Button>
9
+ <Button @click="alipay" icon="logo-alipay"></Button>
10
+ <Button @click="wechat" icon="logo-wechat"></Button>
13
11
  </div>
14
12
  </template>
15
13
  <script>
16
14
  export default{
17
15
  methods:{
18
- notice(type) {
19
- this.$Notice[type]({
20
- title: "通知的标题",
21
- content: "通知的描述",
22
- duration: 5
16
+ alipay() {
17
+ this.$Notice.open({
18
+ icon:'logo-alipay',
19
+ color:'#0082ff',
20
+ title: "尊敬的用户你好",
21
+ content: "我们很高兴通知您,您下个月花呗12900元,不用还了!",
22
+ duration: 10
23
+ });
24
+ },
25
+ wechat() {
26
+ let h = this.$createElement
27
+
28
+ let content = h('div',{},[
29
+ h('p',{ attrs : {style:'margin:10px 0'} },'微信新增了一些新功能,我们邀请您体验!'),
30
+ h('Button',{ props:{ type:'primary' } },'去看看')
31
+ ])
32
+
33
+ this.$Notice.open({
34
+ icon:'logo-wechat',
35
+ color:'#00ff9e',
36
+ title: "尊敬的用户你好",
37
+ content,//: "微信新增了一些新功能,我们邀请您体验!",
38
+ duration: 10
23
39
  });
24
40
  }
25
41
  }
@@ -1,6 +1,7 @@
1
1
  <script>
2
2
  import Info from './info'
3
3
  import Base from './base'
4
+ import Types from './types'
4
5
  import Icon from './icon'
5
6
  import Close from './close'
6
7
  import CN from '../index.md'
@@ -10,6 +11,7 @@ export default {
10
11
  <div>
11
12
  <Info class="typo"/>
12
13
  <Base />
14
+ <Types />
13
15
  <Icon />
14
16
  <Close />
15
17
  <CN class="typo"/>
@@ -0,0 +1,28 @@
1
+ <cn>
2
+ #### 带图标的提醒
3
+ 通过调用不同的方法,可展示不同的类型
4
+ </cn>
5
+
6
+ ```vue
7
+ <template>
8
+ <div>
9
+ <Button @click="notice('info')" type="primary">消息提示 </Button>
10
+ <Button @click="notice('warning')">警告提示 </Button>
11
+ <Button @click="notice('success')">成功提示 </Button>
12
+ <Button @click="notice('error')" type="danger">错误提示 </Button>
13
+ </div>
14
+ </template>
15
+ <script>
16
+ export default{
17
+ methods:{
18
+ notice(type) {
19
+ this.$Notice[type]({
20
+ title: "通知的标题",
21
+ content: "通知的描述",
22
+ duration: 5
23
+ });
24
+ }
25
+ }
26
+ }
27
+ </script>
28
+ ```
@@ -6,6 +6,9 @@ let Notice = {
6
6
  name: 'Notice',
7
7
  open(options = {}) {
8
8
  options = Object.assign({ type: 'default' }, options)
9
+ if (options.icon) {
10
+ delete options.type
11
+ }
9
12
  options.noticeType = 'notice'
10
13
  if (!noticeInstance) {
11
14
  noticeInstance = newInstance({ type: 'notice' })
@@ -18,9 +18,11 @@
18
18
 
19
19
  参数 `options` 为对象,具体说明如下:
20
20
 
21
- | 属性 | 说明 | 类型 | 默认值 |
22
- |----------|----------------------|----------|-----|
23
- | title | 通知提醒的标题 | String | - |
24
- | content | 提示内容 | String | - |
25
- | duration | 自动关闭的延时,单位秒,不关闭可以写 0 | Number | 3 |
26
- | close | 关闭时的回调 | Function | - |
21
+ | 属性 | 说明 | 类型 | 默认值 |
22
+ | -------- | -------------------------------------- | ------------- | ------ |
23
+ | title | 通知提醒的标题 | String | - |
24
+ | content | 提示内容 | String ,vndoe | - |
25
+ | duration | 自动关闭的延时,单位秒,不关闭可以写 0 | Number | 3 |
26
+ | close | 关闭时的回调 | Function | - |
27
+ | icon | 自定义图标 | String | - |
28
+ | color | 自定义图标颜色 | String | - |