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.

80 lines
2.0 KiB

7 years ago
(function () {
7 years ago
var ParentStore = BI.inherit(Fix.Model, {
state: function () {
return {
context: "默认context"
7 years ago
};
7 years ago
},
childContext: ["context"]
7 years ago
});
7 years ago
BI.model("demo.model.context.parent_store",ParentStore)
7 years ago
var ChildStore = BI.inherit(Fix.Model, {
context: ["context"],
computed: {
currContext: function () {
7 years ago
return this.model.context;
7 years ago
}
},
actions: {
changeContext: function () {
this.model.context = "改变后的context";
}
}
7 years ago
});
7 years ago
BI.model("demo.model.context.child_store",ChildStore)
7 years ago
var Child = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.context.child_store");
7 years ago
},
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();
}
7 years ago
};
7 years ago
},
mounted: function () {
}
7 years ago
});
7 years ago
7 years ago
BI.shortcut("demo.fix_context_child", Child);
7 years ago
var Parent = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.context.parent_store");
7 years ago
},
render: function () {
var self = this;
return {
type: "bi.absolute",
items: [{
el: {
7 years ago
type: "demo.fix_context_child"
7 years ago
}
}]
7 years ago
};
7 years ago
},
mounted: function () {
}
});
BI.shortcut("demo.fix_context", Parent);
}());