Browse Source

refactor: tweak data merge strategy (#6833)

* 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
dev
Huo Chunyang 7 years ago
committed by Evan You
parent
commit
ee0e8b5ce1
  1. 4
      src/core/util/options.js

4
src/core/util/options.js

@ -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'
@ -123,7 +123,7 @@ strats.data = function (
return parentVal
}
return mergeDataOrFn.call(this, parentVal, childVal)
return mergeDataOrFn(parentVal, childVal)
}
return mergeDataOrFn(parentVal, childVal, vm)

Loading…
Cancel
Save