Skip to content

Commit

Permalink
refactor: tweak data merge strategy (vuejs#6833)
Browse files Browse the repository at this point in the history
* tweak: The value of this is always undefined

* parentVal and childVal must have a presence, otherwise the strats.data policy function will not be executed
  • Loading branch information
HcySunYang authored and lovelope committed Feb 1, 2018
1 parent 94bdf51 commit 4433af6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/util/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function mergeDataOrFn (
typeof parentVal === 'function' ? parentVal.call(this) : parentVal
)
}
} else if (parentVal || childVal) {
} else {
return function mergedInstanceDataFn () {
// instance merge
const instanceData = typeof childVal === 'function'
Expand Down Expand Up @@ -123,7 +123,7 @@ strats.data = function (

return parentVal
}
return mergeDataOrFn.call(this, parentVal, childVal)
return mergeDataOrFn(parentVal, childVal)
}

return mergeDataOrFn(parentVal, childVal, vm)
Expand Down

0 comments on commit 4433af6

Please sign in to comment.