forked from fanruan/fineui
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.
52 lines
965 B
52 lines
965 B
7 years ago
|
var model = new Fix.Observer({
|
||
|
name: 1,
|
||
|
arr: [{
|
||
|
n: 'a'
|
||
|
}, {
|
||
|
n: 'b'
|
||
|
}]
|
||
|
}).model;
|
||
|
Demo.Computed = BI.inherit(Fix.VM, {
|
||
7 years ago
|
computed: {
|
||
|
b: function () {
|
||
|
return this.model.name + 1
|
||
|
},
|
||
|
c: function () {
|
||
|
return this.model.name + this.model.b
|
||
|
}
|
||
|
},
|
||
7 years ago
|
})
|
||
|
|
||
|
Demo.Store = BI.inherit(Fix.VM, {
|
||
|
_init: function () {
|
||
|
this.computed = new Demo.Computed(model).model;
|
||
|
},
|
||
|
computed: {
|
||
|
b: function () {
|
||
|
return this.computed.c + 1
|
||
|
},
|
||
|
},
|
||
7 years ago
|
methods: {
|
||
|
run: function () {
|
||
7 years ago
|
var t = this.model.b;
|
||
|
this.computed.name = 2;
|
||
7 years ago
|
}
|
||
|
}
|
||
|
});
|
||
7 years ago
|
|
||
7 years ago
|
Demo.Fix = BI.inherit(BI.Widget, {
|
||
|
_store: function () {
|
||
7 years ago
|
return new Demo.Store();
|
||
7 years ago
|
},
|
||
|
watch: {
|
||
|
b: function () {
|
||
|
debugger;
|
||
|
}
|
||
|
},
|
||
|
mounted: function () {
|
||
7 years ago
|
|
||
7 years ago
|
this.store.run()
|
||
|
}
|
||
|
});
|
||
|
|
||
|
BI.shortcut("demo.fix", Demo.Fix);
|