fineui是帆软报表和BI产品线所使用的前端框架。

51 lines
1.3 KiB

7 years ago
(function () {
7 years ago
var model = Fix.define({
name: "原始属性",
arr: [{
7 years ago
n: "a"
7 years ago
}, {
n: 0
}]
});
Demo.Fix = BI.inherit(BI.Widget, {
_store: function () {
return model;
},
watch: {
"name||arr.1.n": function () {
7 years ago
this.button.setText(this.model.name + "-" + this.model.arr[1].n);
7 years ago
}
},
render: function () {
var self = this;
var cnt = 0;
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.button",
ref: function () {
self.button = this;
},
handler: function () {
if (cnt & 1) {
self.model.name += 1;
} else {
self.model.arr[1].n += 1;
}
cnt++;
},
text: this.model.name + "-" + this.model.arr[1].n
}
}]
7 years ago
};
7 years ago
},
mounted: function () {
}
});
7 years ago
BI.shortcut("demo.fix_watcher", Demo.Fix);
7 years ago
}());