Commit efc65a34ff9773901c55ed41e760fa4df9fc69ff
1 parent
6b2cd674
fixed bug of notice when has render and title bug no desc
Showing
2 changed files
with
17 additions
and
2 deletions
Show diff stats
examples/routers/notice.vue
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | <Button @click="success(false)">成功</Button> | 6 | <Button @click="success(false)">成功</Button> |
7 | <Button @click="warning(false)">警告</Button> | 7 | <Button @click="warning(false)">警告</Button> |
8 | <Button @click="error(false)">错误</Button> | 8 | <Button @click="error(false)">错误</Button> |
9 | + <Button @click="testRender()">render</Button> | ||
9 | <p>仅标题</p> | 10 | <p>仅标题</p> |
10 | <Button @click="info(true)">消息</Button> | 11 | <Button @click="info(true)">消息</Button> |
11 | <Button @click="success(true)">成功</Button> | 12 | <Button @click="success(true)">成功</Button> |
@@ -54,7 +55,7 @@ | @@ -54,7 +55,7 @@ | ||
54 | warning (nodesc) { | 55 | warning (nodesc) { |
55 | this.$Notice.warning({ | 56 | this.$Notice.warning({ |
56 | title: '这是通知标题', | 57 | title: '这是通知标题', |
57 | - desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述' | 58 | + desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述', |
58 | }); | 59 | }); |
59 | }, | 60 | }, |
60 | error (nodesc) { | 61 | error (nodesc) { |
@@ -63,6 +64,20 @@ | @@ -63,6 +64,20 @@ | ||
63 | desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述' | 64 | desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述' |
64 | }); | 65 | }); |
65 | }, | 66 | }, |
67 | + testRender () { | ||
68 | + this.$Notice.info({ | ||
69 | + title: '这是通知标题', | ||
70 | + duration: 0, | ||
71 | + // desc: '当你定义了render之后,这个描述会被覆盖', | ||
72 | + render: h => { | ||
73 | + return h('span', {}, [ | ||
74 | + '这是', | ||
75 | + h('Button', {props: {type: 'text'}}, 'render'), | ||
76 | + '函数渲染的' | ||
77 | + ]); | ||
78 | + }, | ||
79 | + }); | ||
80 | + }, | ||
66 | destroy () { | 81 | destroy () { |
67 | this.$Notice.destroy(); | 82 | this.$Notice.destroy(); |
68 | } | 83 | } |
src/components/notice/index.js
@@ -45,7 +45,7 @@ function notice (type, options) { | @@ -45,7 +45,7 @@ function notice (type, options) { | ||
45 | 45 | ||
46 | let withIcon; | 46 | let withIcon; |
47 | 47 | ||
48 | - const with_desc = (options.render && !title) ? '' : desc === '' ? '' : ` ${prefixCls}-with-desc`; | 48 | + const with_desc = (options.render && !title) ? '' : (desc || options.render) ? ` ${prefixCls}-with-desc` : ''; |
49 | 49 | ||
50 | if (type == 'normal') { | 50 | if (type == 'normal') { |
51 | withIcon = false; | 51 | withIcon = false; |