From 3f7a5f1a27afd3d735de2aeadc74f320f6d3a12a Mon Sep 17 00:00:00 2001 From: zhigang.li Date: Thu, 21 Dec 2017 16:42:23 +0800 Subject: [PATCH] udpate notice --- examples/routers/message.vue | 2 +- examples/routers/notice.vue | 13 ++++++++++--- examples/routers/tag.vue | 5 +++++ src/components/base/notification/notice.vue | 3 ++- src/components/base/notification/notification.vue | 1 + src/components/notice/index.js | 1 + src/components/tag/tag.vue | 4 ++-- 7 files changed, 22 insertions(+), 7 deletions(-) diff --git a/examples/routers/message.vue b/examples/routers/message.vue index ecde42f..7fc3a6a 100644 --- a/examples/routers/message.vue +++ b/examples/routers/message.vue @@ -13,7 +13,7 @@ info () { // this.$Message.info('这是一条普通提示'); this.$Message.success({ - // content: '这是一条普通提示2', + content: '这是一条普通提示2', duration: 500, onClose () { // console.log(123) diff --git a/examples/routers/notice.vue b/examples/routers/notice.vue index 31b0125..ce228b8 100644 --- a/examples/routers/notice.vue +++ b/examples/routers/notice.vue @@ -37,11 +37,18 @@ } }); }, - success (nodesc) { + success () { this.$Notice.success({ title: '这是通知标题', - duration: 0, - desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述' + desc: '当你定义了render之后,这个描述会被覆盖', + render: h => { + return h('span', {}, [ + '这是', + h('Button', {props: {type: 'text'}}, 'render'), + '函数渲染的' + ]); + }, + duration: 0 }); }, warning (nodesc) { diff --git a/examples/routers/tag.vue b/examples/routers/tag.vue index 185b351..c847fe5 100644 --- a/examples/routers/tag.vue +++ b/examples/routers/tag.vue @@ -19,6 +19,11 @@ 标签三 标签四

+ 标签一 + 标签二 + 标签三 + 标签四 +

标签一 标签二 标签三 diff --git a/src/components/base/notification/notice.vue b/src/components/base/notification/notice.vue index c1c12d1..ed017dd 100644 --- a/src/components/base/notification/notice.vue +++ b/src/components/base/notification/notice.vue @@ -54,6 +54,7 @@ render: { type: Function }, + hasTitle: Boolean, styles: { type: Object, default: function() { @@ -111,7 +112,7 @@ contentWithIcon () { return [ this.withIcon ? `${this.prefixCls}-content-with-icon` : '', - this.render && !this.title && this.withIcon ? `${this.prefixCls}-content-with-render-notitle` : '' + !this.hasTitle && this.withIcon ? `${this.prefixCls}-content-with-render-notitle` : '' ]; }, messageClasses () { diff --git a/src/components/base/notification/notification.vue b/src/components/base/notification/notification.vue index 70afd06..175a611 100644 --- a/src/components/base/notification/notification.vue +++ b/src/components/base/notification/notification.vue @@ -9,6 +9,7 @@ :content="notice.content" :duration="notice.duration" :render="notice.render" + :has-title="notice.hasTitle" :withIcon="notice.withIcon" :closable="notice.closable" :name="notice.name" diff --git a/src/components/notice/index.js b/src/components/notice/index.js index a03dd22..2e8d20b 100644 --- a/src/components/notice/index.js +++ b/src/components/notice/index.js @@ -76,6 +76,7 @@ function notice (type, options) { content: content, withIcon: withIcon, render: render, + hasTitle: !!title, onClose: onClose, closable: true, type: 'notice' diff --git a/src/components/tag/tag.vue b/src/components/tag/tag.vue index 1b4d4ab..dc01d99 100644 --- a/src/components/tag/tag.vue +++ b/src/components/tag/tag.vue @@ -51,7 +51,7 @@ return [ `${prefixCls}`, { - [`${prefixCls}-${this.color}`]: !!this.color, + [`${prefixCls}-${this.color}`]: !!this.color && oneOf(this.color, initColorList), [`${prefixCls}-${this.type}`]: !!this.type, [`${prefixCls}-closable`]: this.closable, [`${prefixCls}-checked`]: this.isChecked @@ -75,7 +75,7 @@ if (this.type === 'dot') { return ''; } else if (this.type === 'border') { - return `${prefixCls}-color-${this.color}`; + return oneOf(this.color, initColorList) ? `${prefixCls}-color-${this.color}` : ''; } else { return this.color !== undefined ? (this.color === 'default' ? '' : 'rgb(255, 255, 255)') : ''; } -- libgit2 0.21.4