guy 2 years ago
parent
commit
5e8a652ad9
  1. 20
      src/core/4.widget.js

20
src/core/4.widget.js

@ -903,14 +903,24 @@
BI.useContext = function (inject) { BI.useContext = function (inject) {
if (BI.Model.target) { if (BI.Model.target) {
var p = BI.Model.target; var vm = BI.Model.target;
if (inject) { if (inject) {
while (p) { if (vm.$$computed && inject in vm.$$computed) {
if (p.$$context && inject in p.$$context) { return vm;
return p;
} }
p = p._parent; if (vm.$$state && inject in vm.$$state) {
return vm;
} }
if (vm.$$model && inject in vm.$$model) {
return vm;
}
while (vm) {
if (vm.$$context && inject in vm.$$context) {
return vm;
}
vm = vm._parent;
}
return null;
} }
} }
return BI.Model.target; return BI.Model.target;

Loading…
Cancel
Save