From 34f37df008ef3d76a18b211bc2332b099536f33a Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 22 Mar 2018 10:01:53 -0400 Subject: [PATCH] Revert "refactor: remove unnecessary checks (#7875)" This reverts commit 43551b4fb60f449eb28600023eb0d3a3cf604a0e. --- src/core/instance/state.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/instance/state.js b/src/core/instance/state.js index eb8ec4b71b8..b1549b0dcc4 100644 --- a/src/core/instance/state.js +++ b/src/core/instance/state.js @@ -111,8 +111,9 @@ function initProps (vm: Component, propsOptions: Object) { function initData (vm: Component) { let data = vm.$options.data - // $options.data is guaranteed to be a function after merge - data = vm._data = getData(data, vm) + data = vm._data = typeof data === 'function' + ? getData(data, vm) + : data || {} if (!isPlainObject(data)) { data = {} process.env.NODE_ENV !== 'production' && warn(