optimize Notice style when without desc

optimize Notice style when without desc
This commit is contained in:
梁灏 2016-11-04 16:34:05 +08:00
parent 928033f0bd
commit 034412553a
6 changed files with 169 additions and 59 deletions

View file

@ -47,6 +47,11 @@
type: String
}
},
data () {
return {
withDesc: false
}
},
computed: {
baseClass () {
return `${this.prefixCls}-notice`;
@ -56,7 +61,8 @@
this.baseClass,
{
[`${this.className}`]: !!this.className,
[`${this.baseClass}-closable`]: this.closable
[`${this.baseClass}-closable`]: this.closable,
[`${this.baseClass}-with-desc`]: this.withDesc
}
]
},
@ -85,6 +91,11 @@
this.close();
}, this.duration * 1000)
}
// check if with desc in Notice component
if (this.prefixCls === 'ivu-notice') {
this.withDesc = this.$els.content.querySelectorAll(`.${this.prefixCls}-desc`)[0].innerHTML !== '';
}
},
beforeDestroy () {
this.clearCloseTimer();