diff --git a/src/core/util/options.js b/src/core/util/options.js index ad36bb94..945d43c6 100644 --- a/src/core/util/options.js +++ b/src/core/util/options.js @@ -85,18 +85,18 @@ export function mergeDataOrFn ( // it has to be a function to pass previous merges. return function mergedDataFn () { return mergeData( - typeof childVal === 'function' ? childVal.call(this) : childVal, - typeof parentVal === 'function' ? parentVal.call(this) : parentVal + typeof childVal === 'function' ? childVal.call(this, this) : childVal, + typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal ) } } else { return function mergedInstanceDataFn () { // instance merge const instanceData = typeof childVal === 'function' - ? childVal.call(vm) + ? childVal.call(vm, vm) : childVal const defaultData = typeof parentVal === 'function' - ? parentVal.call(vm) + ? parentVal.call(vm, vm) : parentVal if (instanceData) { return mergeData(instanceData, defaultData) diff --git a/test/unit/features/options/data.spec.js b/test/unit/features/options/data.spec.js index 29a48c38..cb8a75ad 100644 --- a/test/unit/features/options/data.spec.js +++ b/test/unit/features/options/data.spec.js @@ -107,7 +107,7 @@ describe('Options data', () => { expect(vm.a).toBe(1) }) - it('should called with this', () => { + it('should be called with this', () => { const vm = new Vue({ template: '