Browse Source

shouldUpdate生命周期

master
guy 7 years ago
parent
commit
4e4066bedd
  1. 5
      demo/js/core/abstract/demo.virtual_group.js
  2. 5
      dist/demo.js

5
demo/js/core/abstract/demo.virtual_group.js

@ -89,6 +89,11 @@ Demo.Item = BI.inherit(BI.Widget, {
} }
}, },
shouldUpdate: function (nextProps) {
var o = this.options;
return o.type !== nextProps.type || o.key !== nextProps.key || o.value !== nextProps.value;
},
update: function (item) { update: function (item) {
this.label.setText(item.value); this.label.setText(item.value);
console.log("更新了一项"); console.log("更新了一项");

5
dist/demo.js vendored

@ -7561,6 +7561,11 @@ Demo.Item = BI.inherit(BI.Widget, {
} }
}, },
shouldUpdate: function (nextProps) {
var o = this.options;
return o.type !== nextProps.type || o.key !== nextProps.key || o.value !== nextProps.value;
},
update: function (item) { update: function (item) {
this.label.setText(item.value); this.label.setText(item.value);
console.log("更新了一项"); console.log("更新了一项");

Loading…
Cancel
Save