fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.7 KiB

7 years ago
(function () {
7 years ago
var model = Fix.define({
name: 1,
arr: [{
7 years ago
n: "a"
7 years ago
}, {
n: 0
}]
});
7 years ago
var Computed = BI.inherit(Fix.Model, {
7 years ago
computed: {
b: function () {
7 years ago
return this.name + 1;
7 years ago
},
c: function () {
7 years ago
return this.arr[1].n + this.b;
7 years ago
}
7 years ago
}
7 years ago
});
7 years ago
7 years ago
var Store = BI.inherit(Fix.Model, {
7 years ago
_init: function () {
7 years ago
this.comp = new Computed(model);
7 years ago
},
7 years ago
computed: {
b: function () {
7 years ago
return this.comp.c + 1;
7 years ago
},
c: function () {
return this.comp.arr[1].n & 1;
}
},
actions: {
run: function () {
this.comp.name++;
this.comp.arr[1].n++;
}
7 years ago
}
7 years ago
});
7 years ago
7 years ago
Demo.Fix = BI.inherit(BI.Widget, {
_store: function () {
return new Store();
},
watch: {
"b&&(c||b)": function () {
7 years ago
this.button.setText(this.model.b);
7 years ago
}
},
render: function () {
var self = this;
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.button",
ref: function () {
self.button = this;
},
handler: function () {
7 years ago
self.store.run();
7 years ago
},
text: this.model.b
}
}]
7 years ago
};
7 years ago
},
mounted: function () {
7 years ago
7 years ago
}
});
BI.shortcut("demo.fix", Demo.Fix);
}());