Skip to content

Commit efc65a3

Browse files
author
zhigang.li
committed
fixed bug of notice when has render and title bug no desc
1 parent 6b2cd67 commit efc65a3

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

examples/routers/notice.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<Button @click="success(false)">成功</Button>
77
<Button @click="warning(false)">警告</Button>
88
<Button @click="error(false)">错误</Button>
9+
<Button @click="testRender()">render</Button>
910
<p>仅标题</p>
1011
<Button @click="info(true)">消息</Button>
1112
<Button @click="success(true)">成功</Button>
@@ -54,7 +55,7 @@
5455
warning (nodesc) {
5556
this.$Notice.warning({
5657
title: '这是通知标题',
57-
desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述'
58+
desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述',
5859
});
5960
},
6061
error (nodesc) {
@@ -63,6 +64,20 @@
6364
desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述'
6465
});
6566
},
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+
},
6681
destroy () {
6782
this.$Notice.destroy();
6883
}

src/components/notice/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function notice (type, options) {
4545

4646
let withIcon;
4747

48-
const with_desc = (options.render && !title) ? '' : desc === '' ? '' : ` ${prefixCls}-with-desc`;
48+
const with_desc = (options.render && !title) ? '' : (desc || options.render) ? ` ${prefixCls}-with-desc` : '';
4949

5050
if (type == 'normal') {
5151
withIcon = false;

0 commit comments

Comments
 (0)