Browse Source

Merge pull request #202004 in DEC/fineui from master to feature/x

* commit 'abfa2f72a9fd71c499f08cf11335ad95dcc3940c':
  KERNEL-13158: 优化useContext
research/test
superman 2 years ago
parent
commit
64de6fa1b6
  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