提交 c1161501 编写于 作者: fxy060608's avatar fxy060608

feat(app-plus-nvue): support vuex

上级 812ed0a0
......@@ -711,8 +711,8 @@ Dep.prototype.removeSub = function removeSub (sub) {
};
Dep.prototype.depend = function depend () {
if (Dep.target) {
Dep.target.addDep(this);
if (Dep.SharedObject.target) {
Dep.SharedObject.target.addDep(this);
}
};
......@@ -733,17 +733,20 @@ Dep.prototype.notify = function notify () {
// The current target watcher being evaluated.
// This is globally unique because only one watcher
// can be evaluated at a time.
Dep.target = null;
// fixed by xxxxxx (nvue shared vuex)
/* eslint-disable no-undef */
Dep.SharedObject = typeof SharedObject !== 'undefined' ? SharedObject : {};
Dep.SharedObject.target = null;
var targetStack = [];
function pushTarget (target) {
targetStack.push(target);
Dep.target = target;
Dep.SharedObject.target = target;
}
function popTarget () {
targetStack.pop();
Dep.target = targetStack[targetStack.length - 1];
Dep.SharedObject.target = targetStack[targetStack.length - 1];
}
/* */
......@@ -1028,7 +1031,7 @@ function defineReactive$$1 (
configurable: true,
get: function reactiveGetter () {
var value = getter ? getter.call(obj) : val;
if (Dep.target) {
if (Dep.SharedObject.target) { // fixed by xxxxxx
dep.depend();
if (childOb) {
childOb.dep.depend();
......@@ -4751,7 +4754,7 @@ function createComputedGetter (key) {
if (watcher.dirty) {
watcher.evaluate();
}
if (Dep.target) {
if (Dep.SharedObject.target) {// fixed by xxxxxx
watcher.depend();
}
return watcher.value
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册