diff --git a/examples/dev.html b/examples/dev.html
index 7a11279b2..975879916 100644
--- a/examples/dev.html
+++ b/examples/dev.html
@@ -20,34 +20,53 @@
}
},
setup: function () {
- var layout;
+ var list, count = 0;
return function () {
return {
- type: "bi.left",
+ type: "bi.vertical",
items: [{
- type: "bi.button",
- text: "点击",
- handler: function () {
- layout.populate([{
- type: "bi.label",
- key: "1",
- text: 1
- }, {
+ type: "bi.virtual_group",
+ height: 100,
+ ref: function (_ref) {
+ list = _ref;
+ },
+ items: BI.range(10).map(function (item, i) {
+ var r = {
type: "bi.label",
- key: "123",
- text: "start"
- }])
- }
+ text: item,
+ // 指定key后,会根据key值进行前后两次数据对比,否则会根据数组索引进行数据对比
+ key: item,
+ cls: "bi-border"
+ };
+ if (i === 9) {
+ r.width = "fill";
+ r.key = "唯一的标识";
+ }
+ return r;
+ }),
+ layouts: [{
+ type: "bi.inline",
+ tgap: 10,
+ lgap: 10
+ }]
}, {
- type: "bi.left",
- lgap: 10,
- items: [{
- type: "bi.label",
- key: "123",
- text: "start"
- }],
- ref: function (_ref) {
- layout = _ref;
+ type: "bi.button",
+ text: "点击删除第一个元素",
+ handler: function () {
+ count++;
+ list.populate(BI.range(10 - count).map(function (i) {
+ var r = {
+ type: "bi.label",
+ text: i + count,
+ key: i + count,
+ cls: "bi-border"
+ };
+ if (i + count === 9) {
+ r.width = "fill";
+ r.key = "唯一的标识";
+ }
+ return r;
+ }));
}
}]
};
diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js
index d6634e328..0bde292a7 100644
--- a/src/core/wrapper/layout.js
+++ b/src/core/wrapper/layout.js
@@ -551,9 +551,11 @@ BI.Layout = BI.inherit(BI.Widget, {
c.destroy();
});
this._children = {};
+ this._isMounted = false;
}
this.options.items = opt.items;
this.stroke(opt.items);
+ this._mount();
},
update: function (opt) {