Skip to content

Commit d9cde49

Browse files
committed
Fix warning in data merge strategy
This allows to reuse the data merge strategy without forcing it to be a function when used in a child
1 parent 931aaea commit d9cde49

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/core/util/options.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,15 @@ function mergeData (to: Object, from: ?Object): Object {
6767
strats.data = function (
6868
parentVal: any,
6969
childVal: any,
70-
vm?: Component
70+
vm?: Component,
71+
option: String
7172
): ?Function {
7273
if (!vm) {
7374
// in a Vue.extend merge, both should be functions
7475
if (!childVal) {
7576
return parentVal
7677
}
77-
if (typeof childVal !== 'function') {
78+
if (option === 'data' && typeof childVal !== 'function') {
7879
process.env.NODE_ENV !== 'production' && warn(
7980
'The "data" option should be a function ' +
8081
'that returns a per-instance value in component ' +

0 commit comments

Comments
 (0)