From f48bc716c7dcf1e40e09797a6519de4c0f377613 Mon Sep 17 00:00:00 2001 From: HcySunYang Date: Tue, 17 Oct 2017 20:36:41 +0800 Subject: [PATCH 1/2] tweak: The value of this is always undefined --- src/core/util/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/util/options.js b/src/core/util/options.js index 3be38b8e56b..1de627d325b 100644 --- a/src/core/util/options.js +++ b/src/core/util/options.js @@ -123,7 +123,7 @@ strats.data = function ( return parentVal } - return mergeDataOrFn.call(this, parentVal, childVal) + return mergeDataOrFn(parentVal, childVal) } return mergeDataOrFn(parentVal, childVal, vm) From 068c3bea0f2b0da44dfb0cf9e8fe24f7abd61e8e Mon Sep 17 00:00:00 2001 From: HcySunYang Date: Wed, 18 Oct 2017 19:36:56 +0800 Subject: [PATCH 2/2] parentVal and childVal must have a presence, otherwise the strats.data policy function will not be executed --- src/core/util/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/util/options.js b/src/core/util/options.js index 1de627d325b..ad36bb94151 100644 --- a/src/core/util/options.js +++ b/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'