Browse Source

Pull request #2118: 无JIRA任务 整理代码

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '584a0b2c1c768dcb5ceab2924a4ef08c42ca7e1f':
  整理代码
es6
guy 3 years ago
parent
commit
8dd16607bc
  1. 65
      examples/dev.html
  2. 2
      src/core/wrapper/layout.js

65
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;
}));
}
}]
};

2
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) {

Loading…
Cancel
Save