Commit 3f7a5f1a27afd3d735de2aeadc74f320f6d3a12a
1 parent
baa75b0a
udpate notice
Showing
7 changed files
with
22 additions
and
7 deletions
Show diff stats
examples/routers/message.vue
examples/routers/notice.vue
... | ... | @@ -37,11 +37,18 @@ |
37 | 37 | } |
38 | 38 | }); |
39 | 39 | }, |
40 | - success (nodesc) { | |
40 | + success () { | |
41 | 41 | this.$Notice.success({ |
42 | 42 | title: '这是通知标题', |
43 | - duration: 0, | |
44 | - desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述' | |
43 | + desc: '当你定义了render之后,这个描述会被覆盖', | |
44 | + render: h => { | |
45 | + return h('span', {}, [ | |
46 | + '这是', | |
47 | + h('Button', {props: {type: 'text'}}, 'render'), | |
48 | + '函数渲染的' | |
49 | + ]); | |
50 | + }, | |
51 | + duration: 0 | |
45 | 52 | }); |
46 | 53 | }, |
47 | 54 | warning (nodesc) { | ... | ... |
examples/routers/tag.vue
... | ... | @@ -19,6 +19,11 @@ |
19 | 19 | <Tag type="dot" closable color="#EF6AFF" checkable>标签三</Tag> |
20 | 20 | <Tag closable color="default" checkable>标签四</Tag> |
21 | 21 | <br><br> |
22 | + <Tag closable color="#EF6AFF">标签一</Tag> | |
23 | + <Tag type="border" closable color="#EF6AFF">标签二</Tag> | |
24 | + <Tag type="dot" closable color="#EF6AFF">标签三</Tag> | |
25 | + <Tag closable color="default">标签四</Tag> | |
26 | + <br><br> | |
22 | 27 | <Tag type="border" closable color="blue" checkable>标签一</Tag> |
23 | 28 | <Tag type="border" closable color="green">标签二</Tag> |
24 | 29 | <Tag type="border" closable color="red">标签三</Tag> | ... | ... |
src/components/base/notification/notice.vue
... | ... | @@ -54,6 +54,7 @@ |
54 | 54 | render: { |
55 | 55 | type: Function |
56 | 56 | }, |
57 | + hasTitle: Boolean, | |
57 | 58 | styles: { |
58 | 59 | type: Object, |
59 | 60 | default: function() { |
... | ... | @@ -111,7 +112,7 @@ |
111 | 112 | contentWithIcon () { |
112 | 113 | return [ |
113 | 114 | this.withIcon ? `${this.prefixCls}-content-with-icon` : '', |
114 | - this.render && !this.title && this.withIcon ? `${this.prefixCls}-content-with-render-notitle` : '' | |
115 | + !this.hasTitle && this.withIcon ? `${this.prefixCls}-content-with-render-notitle` : '' | |
115 | 116 | ]; |
116 | 117 | }, |
117 | 118 | messageClasses () { | ... | ... |
src/components/base/notification/notification.vue
src/components/notice/index.js
src/components/tag/tag.vue
... | ... | @@ -51,7 +51,7 @@ |
51 | 51 | return [ |
52 | 52 | `${prefixCls}`, |
53 | 53 | { |
54 | - [`${prefixCls}-${this.color}`]: !!this.color, | |
54 | + [`${prefixCls}-${this.color}`]: !!this.color && oneOf(this.color, initColorList), | |
55 | 55 | [`${prefixCls}-${this.type}`]: !!this.type, |
56 | 56 | [`${prefixCls}-closable`]: this.closable, |
57 | 57 | [`${prefixCls}-checked`]: this.isChecked |
... | ... | @@ -75,7 +75,7 @@ |
75 | 75 | if (this.type === 'dot') { |
76 | 76 | return ''; |
77 | 77 | } else if (this.type === 'border') { |
78 | - return `${prefixCls}-color-${this.color}`; | |
78 | + return oneOf(this.color, initColorList) ? `${prefixCls}-color-${this.color}` : ''; | |
79 | 79 | } else { |
80 | 80 | return this.color !== undefined ? (this.color === 'default' ? '' : 'rgb(255, 255, 255)') : ''; |
81 | 81 | } | ... | ... |