Browse Source

Pull request #3147: KERNEL-13158: 优化useContext

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

* commit 'b7cce8557606cbe143978621d2e7b9023126bb95':
  KERNEL-13158: 优化useContext
es6
guy-王川 2 years ago
parent
commit
abfa2f72a9
  1. 3
      src/base/combination/navigation.js
  2. 2
      src/core/4.widget.js

3
src/base/combination/navigation.js

@ -43,9 +43,10 @@ BI.Navigation = BI.inherit(BI.Widget, {
return self.showIndex + v; return self.showIndex + v;
}, },
cardCreator: function (v) { cardCreator: function (v) {
BI.Widget.pushContext(self);
var card = o.cardCreator(v); var card = o.cardCreator(v);
BI.Widget.popContext();
self.cardMap[v] = card; self.cardMap[v] = card;
return card; return card;
}, },
afterCardCreated: BI.bind(this.afterCardCreated, this), afterCardCreated: BI.bind(this.afterCardCreated, this),

2
src/core/4.widget.js

@ -903,7 +903,7 @@
BI.useContext = function (inject) { BI.useContext = function (inject) {
// 通过组件找最近的store // 通过组件找最近的store
var vm = BI.Widget.findStore(BI.Widget.current); var vm = BI.Widget.findStore(BI.Widget.current || BI.Widget.context);
if (vm) { if (vm) {
if (inject) { if (inject) {
if (vm.$$computed && inject in vm.$$computed) { if (vm.$$computed && inject in vm.$$computed) {

Loading…
Cancel
Save