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

feat(app-plus-nvue): support vuex

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