Skip to content

Commit

Permalink
修复动态增加函数属性的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
dntzhang committed Oct 4, 2018
1 parent 95643e2 commit 611dee6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 44 deletions.
13 changes: 2 additions & 11 deletions packages/westore-cloud/utils/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,13 @@ function _push(diffResult, resolve) {
}

function update(patch) {
let needDiff = false
let diffResult = patch
defineFnProp(globalStore.data)
if (patch) {
for (let key in patch) {
updateByPath(globalStore.data, key, patch[key])
if (typeof patch[key] === 'object') {
needDiff = true
}
}
} else {
needDiff = true
}
if (needDiff) {
diffResult = diff(globalStore.data, originData)
}
defineFnProp(globalStore.data)
let diffResult = diff(globalStore.data, originData)
for (let key in globalStore.instances) {
globalStore.instances[key].forEach(ins => {
ins.setData.call(ins, diffResult)
Expand Down
13 changes: 2 additions & 11 deletions packages/westore-plugin/miniprogram/utils/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,13 @@ function _push(diffResult, resolve) {
}

function update(patch) {
let needDiff = false
let diffResult = patch
defineFnProp(globalStore.data)
if (patch) {
for (let key in patch) {
updateByPath(globalStore.data, key, patch[key])
if (typeof patch[key] === 'object') {
needDiff = true
}
}
} else {
needDiff = true
}
if (needDiff) {
diffResult = diff(globalStore.data, originData)
}
defineFnProp(globalStore.data)
let diffResult = diff(globalStore.data, originData)
for (let key in globalStore.instances) {
globalStore.instances[key].forEach(ins => {
ins.setData.call(ins, diffResult)
Expand Down
13 changes: 2 additions & 11 deletions packages/westore/utils/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,13 @@ function _push(diffResult, resolve) {
}

function update(patch) {
let needDiff = false
let diffResult = patch
defineFnProp(globalStore.data)
if (patch) {
for (let key in patch) {
updateByPath(globalStore.data, key, patch[key])
if (typeof patch[key] === 'object') {
needDiff = true
}
}
} else {
needDiff = true
}
if (needDiff) {
diffResult = diff(globalStore.data, originData)
}
defineFnProp(globalStore.data)
let diffResult = diff(globalStore.data, originData)
for (let key in globalStore.instances) {
globalStore.instances[key].forEach(ins => {
ins.setData.call(ins, diffResult)
Expand Down
13 changes: 2 additions & 11 deletions utils/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,13 @@ function _push(diffResult, resolve) {
}

function update(patch) {
let needDiff = false
let diffResult = patch
defineFnProp(globalStore.data)
if (patch) {
for (let key in patch) {
updateByPath(globalStore.data, key, patch[key])
if (typeof patch[key] === 'object') {
needDiff = true
}
}
} else {
needDiff = true
}
if (needDiff) {
diffResult = diff(globalStore.data, originData)
}
defineFnProp(globalStore.data)
let diffResult = diff(globalStore.data, originData)
for (let key in globalStore.instances) {
globalStore.instances[key].forEach(ins => {
ins.setData.call(ins, diffResult)
Expand Down

0 comments on commit 611dee6

Please sign in to comment.