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.
 
 
 

79 lines
2.0 KiB

(function () {
var ParentStore = BI.inherit(Fix.Model, {
state: function () {
return {
context: "默认context"
};
},
childContext: ["context"]
});
BI.model("demo.model.context.parent_store",ParentStore)
var ChildStore = BI.inherit(Fix.Model, {
context: ["context"],
computed: {
currContext: function () {
return this.model.context;
}
},
actions: {
changeContext: function () {
this.model.context = "改变后的context";
}
}
});
BI.model("demo.model.context.child_store",ChildStore)
var Child = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.context.child_store");
},
watch: {
currContext: function (val) {
this.button.setText(val);
}
},
render: function () {
var self = this;
return {
type: "bi.button",
ref: function () {
self.button = this;
},
text: this.model.context,
handler: function () {
self.store.changeContext();
}
};
},
mounted: function () {
}
});
BI.shortcut("demo.fix_context_child", Child);
var Parent = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.context.parent_store");
},
render: function () {
var self = this;
return {
type: "bi.absolute",
items: [{
el: {
type: "demo.fix_context_child"
}
}]
};
},
mounted: function () {
}
});
BI.shortcut("demo.fix_context", Parent);
}());