fix(Noticebar): 支持动态更新text @rex-zsd (#314)

#279 #268
This commit is contained in:
rex 2018-06-28 19:46:14 +08:00 committed by Yao
parent 274dca17b7
commit 3305aee3e4

View File

@ -6,7 +6,10 @@ Component({
properties: {
text: {
type: String,
value: ''
value: '',
observer(newVal) {
this.setData({}, this._init);
}
},
mode: {
type: String,
@ -71,10 +74,6 @@ Component({
timer && clearTimeout(timer);
},
ready() {
this._init();
},
methods: {
_checkMode(val) {
const isValidMode = ~VALID_MODE.indexOf(val);
@ -90,7 +89,7 @@ Component({
.select('.zan-noticebar__content')
.boundingClientRect((rect) => {
if (!rect || !rect.width) {
throw new Error('页面缺少 noticebar 元素');
return;
}
this.setData({
width: rect.width