Browse Source

Pull request #1846: 无JIRA任务 feat: 恢复提交updateMode

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

* commit '6ce630e67c99cab93d7310f30050cb478ed39293':
  无JIRA任务 feat: 恢复提交updateMode
  Revert "无JIRA任务 revert: 5fb75ef130 [5fb75ef]"
  无JIRA任务 feat: 恢复提交updateMode
es6
parent
commit
812dc72e9e
  1. 3
      src/core/widget.js
  2. 26
      src/core/wrapper/layout.js
  3. 2
      ui/less/var.less

3
src/core/widget.js

@ -76,8 +76,7 @@
shouldUpdate: null, shouldUpdate: null,
update: function () { update: null,
},
beforeUpdate: null, beforeUpdate: null,

26
src/core/wrapper/layout.js

@ -71,12 +71,13 @@ BI.Layout = BI.inherit(BI.Widget, {
var self = this; var self = this;
var frag = BI.Widget._renderEngine.createFragment(); var frag = BI.Widget._renderEngine.createFragment();
var hasChild = false; var hasChild = false;
BI.each(this._children, function (i, widget) { for (var key in this._children) {
if (widget.element !== self.element) { var child = this._children[key];
frag.appendChild(widget.element[0]); if (child.element !== self.element) {
frag.appendChild(child.element[0]);
hasChild = true; hasChild = true;
} }
}); }
if (hasChild === true) { if (hasChild === true) {
this.appendFragment(frag); this.appendFragment(frag);
} }
@ -268,19 +269,13 @@ BI.Layout = BI.inherit(BI.Widget, {
if (!child.shouldUpdate) { if (!child.shouldUpdate) {
return null; return null;
} }
return child.shouldUpdate(this._getOptions(item)) === true; return child.shouldUpdate(this._getOptions(item));
}, },
updateItemAt: function (index, item) { updateItemAt: function (index, item) {
if (index < 0 || index > this.options.items.length - 1) { if (index < 0 || index > this.options.items.length - 1) {
return; return;
} }
var child = this._children[this._getChildName(index)];
var updated;
if (updated = child.update(this._getOptions(item))) {
return updated;
}
var del = this._children[this._getChildName(index)]; var del = this._children[this._getChildName(index)];
delete this._children[this._getChildName(index)]; delete this._children[this._getChildName(index)];
this.options.items.splice(index, 1); this.options.items.splice(index, 1);
@ -367,7 +362,14 @@ BI.Layout = BI.inherit(BI.Widget, {
patchItem: function (oldVnode, vnode, index) { patchItem: function (oldVnode, vnode, index) {
var shouldUpdate = this.shouldUpdateItem(index, vnode); var shouldUpdate = this.shouldUpdateItem(index, vnode);
if (shouldUpdate === true || (shouldUpdate === null && !this._compare(oldVnode, vnode))) { var child = this._children[this._getChildName(index)];
if (shouldUpdate) {
return child._update(this._getOptions(vnode), shouldUpdate);
}
if (shouldUpdate === null && !this._compare(oldVnode, vnode)) {
// if (child.update) {
// return child.update(this._getOptions(vnode));
// }
return this.updateItemAt(index, vnode); return this.updateItemAt(index, vnode);
} }
}, },

2
ui/less/var.less

@ -2,4 +2,4 @@
@fontUrl: '@{webUrl}font/'; //图片的基本地址 @fontUrl: '@{webUrl}font/'; //图片的基本地址
@imageUrl: '@{webUrl}images/1x/'; //图片的基本地址 @imageUrl: '@{webUrl}images/1x/'; //图片的基本地址
@image2xUrl: '@{webUrl}images/2x/'; //2倍图片的基本地址 @image2xUrl: '@{webUrl}images/2x/'; //2倍图片的基本地址

Loading…
Cancel
Save