From 3305aee3e4149b02595428d188140f3717e529f4 Mon Sep 17 00:00:00 2001 From: rex Date: Thu, 28 Jun 2018 19:46:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(Noticebar):=20=E6=94=AF=E6=8C=81=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=9B=B4=E6=96=B0text=20@rex-zsd=20(#314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #279 #268 --- packages/noticebar/index.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/noticebar/index.js b/packages/noticebar/index.js index 27112b52..63f4780e 100644 --- a/packages/noticebar/index.js +++ b/packages/noticebar/index.js @@ -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