Browse Source

Pull request #1543: 无JIRA任务 chore: update demo

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit '15c19bdf901cf8fbe63f440f77f637448fc73e0c':
  无JIRA任务 chore: update demo
  Revert "DEC-15325 fix: 解决click-blur popup挂在body上和IE11子元素触发blur场景"
  无JIRA任务 chore: update demo
  DEC-15325 fix: 解决click-blur popup挂在body上和IE11子元素触发blur场景
es6
parent
commit
b472cdc173
  1. 7
      demo/js/config/fix.js
  2. 10
      demo/js/fix-2.0/context.js
  3. 102
      demo/js/fix-2.0/inject.js

7
demo/js/config/fix.js

@ -46,4 +46,9 @@ Demo.FIX_CONFIG = [{
pId: 7,
text: "场景",
value: "demo.fix_scene"
}];
}, {
id: 80,
pId: 7,
text: "inject",
value: "demo.fix_inject"
}];

10
demo/js/fix-2.0/context.js

@ -8,6 +8,8 @@
childContext: ["context"]
});
BI.model("demo.model.context.parent_store",ParentStore)
var ChildStore = BI.inherit(Fix.Model, {
context: ["context"],
computed: {
@ -22,9 +24,11 @@
}
});
BI.model("demo.model.context.child_store",ChildStore)
var Child = BI.inherit(BI.Widget, {
_store: function () {
return new ChildStore();
return BI.Models.getModel("demo.model.context.child_store");
},
watch: {
currContext: function (val) {
@ -53,7 +57,7 @@
var Parent = BI.inherit(BI.Widget, {
_store: function () {
return new ParentStore();
return BI.Models.getModel("demo.model.context.parent_store");
},
render: function () {
var self = this;
@ -72,4 +76,4 @@
});
BI.shortcut("demo.fix_context", Parent);
}());
}());

102
demo/js/fix-2.0/inject.js

@ -0,0 +1,102 @@
(function () {
var ParentStore = BI.inherit(Fix.Model, {
state: function () {
return {
context: {
one: {
key: "one.key"
}
}
};
},
childContext: ["context"],
actions: {
changeContext: function () {
this.model.context = {
two: {
key: "two.key"
}
};
}
}
});
BI.model("demo.model.inject.parent_store", ParentStore);
var ChildStore = BI.inherit(Fix.Model, {
inject: ["context"],
computed: {
currContext: function () {
return this.model.context.one.key;
}
},
actions: {
changeContext: function () {
this.model.context = {
one: {
key: "one.changed_key"
}
};
}
}
});
BI.model("demo.model.inject.child_store", ChildStore);
var Child = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.inject.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.currContext,
handler: function () {
self.store.changeContext();
}
};
},
});
BI.shortcut("demo.fix_inject_child", Child);
var Parent = BI.inherit(BI.Widget, {
_store: function () {
return BI.Models.getModel("demo.model.inject.parent_store");
},
render: function () {
var self = this;
return {
type: "bi.vertical",
items: [{
el: {
type: "demo.fix_inject_child"
}
}, {
el: {
type: "bi.button",
text: "点击修改parent state",
handler: function () {
self.store.changeContext();
}
}
}]
};
},
mounted: function () {
}
});
BI.shortcut("demo.fix_inject", Parent);
}());
Loading…
Cancel
Save