udpate notice

This commit is contained in:
zhigang.li 2017-12-21 16:42:23 +08:00
parent baa75b0aef
commit 3f7a5f1a27
7 changed files with 22 additions and 7 deletions

View file

@ -13,7 +13,7 @@
info () { info () {
// this.$Message.info(''); // this.$Message.info('');
this.$Message.success({ this.$Message.success({
// content: '2', content: '这是一条普通提示2',
duration: 500, duration: 500,
onClose () { onClose () {
// console.log(123) // console.log(123)

View file

@ -37,11 +37,18 @@
} }
}); });
}, },
success (nodesc) { success () {
this.$Notice.success({ this.$Notice.success({
title: '这是通知标题', title: '这是通知标题',
duration: 0, desc: '当你定义了render之后这个描述会被覆盖',
desc: nodesc ? '' : '这里是通知描述这里,是通知描述这里是通知描述这里,是通知描述这里,是通知描述这里是通知描述这里是通知描述' render: h => {
return h('span', {}, [
'这是',
h('Button', {props: {type: 'text'}}, 'render'),
'函数渲染的'
]);
},
duration: 0
}); });
}, },
warning (nodesc) { warning (nodesc) {

View file

@ -19,6 +19,11 @@
<Tag type="dot" closable color="#EF6AFF" checkable>标签三</Tag> <Tag type="dot" closable color="#EF6AFF" checkable>标签三</Tag>
<Tag closable color="default" checkable>标签四</Tag> <Tag closable color="default" checkable>标签四</Tag>
<br><br> <br><br>
<Tag closable color="#EF6AFF">标签一</Tag>
<Tag type="border" closable color="#EF6AFF">标签二</Tag>
<Tag type="dot" closable color="#EF6AFF">标签三</Tag>
<Tag closable color="default">标签四</Tag>
<br><br>
<Tag type="border" closable color="blue" checkable>标签一</Tag> <Tag type="border" closable color="blue" checkable>标签一</Tag>
<Tag type="border" closable color="green">标签二</Tag> <Tag type="border" closable color="green">标签二</Tag>
<Tag type="border" closable color="red">标签三</Tag> <Tag type="border" closable color="red">标签三</Tag>

View file

@ -54,6 +54,7 @@
render: { render: {
type: Function type: Function
}, },
hasTitle: Boolean,
styles: { styles: {
type: Object, type: Object,
default: function() { default: function() {
@ -111,7 +112,7 @@
contentWithIcon () { contentWithIcon () {
return [ return [
this.withIcon ? `${this.prefixCls}-content-with-icon` : '', 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 () { messageClasses () {

View file

@ -9,6 +9,7 @@
:content="notice.content" :content="notice.content"
:duration="notice.duration" :duration="notice.duration"
:render="notice.render" :render="notice.render"
:has-title="notice.hasTitle"
:withIcon="notice.withIcon" :withIcon="notice.withIcon"
:closable="notice.closable" :closable="notice.closable"
:name="notice.name" :name="notice.name"

View file

@ -76,6 +76,7 @@ function notice (type, options) {
content: content, content: content,
withIcon: withIcon, withIcon: withIcon,
render: render, render: render,
hasTitle: !!title,
onClose: onClose, onClose: onClose,
closable: true, closable: true,
type: 'notice' type: 'notice'

View file

@ -51,7 +51,7 @@
return [ return [
`${prefixCls}`, `${prefixCls}`,
{ {
[`${prefixCls}-${this.color}`]: !!this.color, [`${prefixCls}-${this.color}`]: !!this.color && oneOf(this.color, initColorList),
[`${prefixCls}-${this.type}`]: !!this.type, [`${prefixCls}-${this.type}`]: !!this.type,
[`${prefixCls}-closable`]: this.closable, [`${prefixCls}-closable`]: this.closable,
[`${prefixCls}-checked`]: this.isChecked [`${prefixCls}-checked`]: this.isChecked
@ -75,7 +75,7 @@
if (this.type === 'dot') { if (this.type === 'dot') {
return ''; return '';
} else if (this.type === 'border') { } else if (this.type === 'border') {
return `${prefixCls}-color-${this.color}`; return oneOf(this.color, initColorList) ? `${prefixCls}-color-${this.color}` : '';
} else { } else {
return this.color !== undefined ? (this.color === 'default' ? '' : 'rgb(255, 255, 255)') : ''; return this.color !== undefined ? (this.color === 'default' ? '' : 'rgb(255, 255, 255)') : '';
} }