From efc65a34ff9773901c55ed41e760fa4df9fc69ff Mon Sep 17 00:00:00 2001 From: zhigang.li Date: Fri, 5 Jan 2018 15:23:46 +0800 Subject: [PATCH] fixed bug of notice when has render and title bug no desc --- examples/routers/notice.vue | 17 ++++++++++++++++- src/components/notice/index.js | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/examples/routers/notice.vue b/examples/routers/notice.vue index ce228b8..2507b9d 100644 --- a/examples/routers/notice.vue +++ b/examples/routers/notice.vue @@ -6,6 +6,7 @@ +

仅标题

@@ -54,7 +55,7 @@ warning (nodesc) { this.$Notice.warning({ title: '这是通知标题', - desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述' + desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述', }); }, error (nodesc) { @@ -63,6 +64,20 @@ desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述' }); }, + testRender () { + this.$Notice.info({ + title: '这是通知标题', + duration: 0, + // desc: '当你定义了render之后,这个描述会被覆盖', + render: h => { + return h('span', {}, [ + '这是', + h('Button', {props: {type: 'text'}}, 'render'), + '函数渲染的' + ]); + }, + }); + }, destroy () { this.$Notice.destroy(); } diff --git a/src/components/notice/index.js b/src/components/notice/index.js index 2e8d20b..54d3c4a 100644 --- a/src/components/notice/index.js +++ b/src/components/notice/index.js @@ -45,7 +45,7 @@ function notice (type, options) { let withIcon; - const with_desc = (options.render && !title) ? '' : desc === '' ? '' : ` ${prefixCls}-with-desc`; + const with_desc = (options.render && !title) ? '' : (desc || options.render) ? ` ${prefixCls}-with-desc` : ''; if (type == 'normal') { withIcon = false; -- libgit2 0.21.4