Skip to content

Commit c33955f

Browse files
HcySunYang孙广彪
authored and
孙广彪
committed
refactor: tweak data merge strategy (vuejs#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
1 parent 4fc479d commit c33955f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/core/util/options.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function mergeDataOrFn (
100100
typeof parentVal === 'function' ? parentVal.call(this) : parentVal
101101
)
102102
}
103-
} else if (parentVal || childVal) {
103+
} else {
104104
return function mergedInstanceDataFn () {
105105
// instance merge
106106
const instanceData = typeof childVal === 'function'
@@ -134,7 +134,7 @@ strats.data = function (
134134

135135
return parentVal
136136
}
137-
return mergeDataOrFn.call(this, parentVal, childVal)
137+
return mergeDataOrFn(parentVal, childVal)
138138
}
139139

140140
return mergeDataOrFn(parentVal, childVal, vm)

0 commit comments

Comments
 (0)