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 孙广彪 committed Dec 15, 2017
1 parent 4fc479d commit c33955f
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 @@ -100,7 +100,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 @@ -134,7 +134,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 c33955f

Please sign in to comment.