From d3129d6bb1605fcfdd22bb279c29ad264a8e4dea Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 24 Mar 2017 14:48:56 +0800 Subject: [PATCH] =?UTF-8?q?update=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/core/abstract/demo.virtual_group.js | 3 +-- dist/core.js | 11 +++++------ src/core/widget.js | 4 +--- src/core/wrapper/layout.js | 7 ++++--- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/demo/js/core/abstract/demo.virtual_group.js b/demo/js/core/abstract/demo.virtual_group.js index e07175f60..77e33d216 100644 --- a/demo/js/core/abstract/demo.virtual_group.js +++ b/demo/js/core/abstract/demo.virtual_group.js @@ -66,14 +66,13 @@ Demo.Item = BI.inherit(BI.Widget, { update: function (item) { this.label.setText(item.value); console.log("更新了一项"); - return true; }, created: function () { console.log("创建了一项"); }, - destroyed: function(){ + destroyed: function () { console.log("删除了一项"); } }); diff --git a/dist/core.js b/dist/core.js index ee7845ebb..8c5bc6811 100644 --- a/dist/core.js +++ b/dist/core.js @@ -14342,9 +14342,7 @@ BI.Widget = BI.inherit(BI.OB, { }, - update: function () { - - }, + update: null, destroyed: function () { }, @@ -19482,9 +19480,10 @@ BI.Layout = BI.inherit(BI.Widget, { return; } - var updated; - if (updated = this._children[this._getChildName(index)].update(this._getOptions(item))) { - return updated; + var child = this._children[this._getChildName(index)]; + if (child.update) { + child.update(this._getOptions(item)); + return true; } this._children[this._getChildName(index)].destroy(); var w = this._addElement(index, item); diff --git a/src/core/widget.js b/src/core/widget.js index b5d1f5666..860e16d4d 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -43,9 +43,7 @@ BI.Widget = BI.inherit(BI.OB, { }, - update: function () { - - }, + update: null, destroyed: function () { }, diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js index 424a51e67..4dc406e53 100644 --- a/src/core/wrapper/layout.js +++ b/src/core/wrapper/layout.js @@ -224,9 +224,10 @@ BI.Layout = BI.inherit(BI.Widget, { return; } - var updated; - if (updated = this._children[this._getChildName(index)].update(this._getOptions(item))) { - return updated; + var child = this._children[this._getChildName(index)]; + if (child.update) { + child.update(this._getOptions(item)); + return true; } this._children[this._getChildName(index)].destroy(); var w = this._addElement(index, item);