Skip to content

Commit 34f37df

Browse files
yyx990803aJean
authored andcommitted
Revert "refactor: remove unnecessary checks (vuejs#7875)"
This reverts commit 43551b4.
1 parent cd8177c commit 34f37df

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/core/instance/state.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ function initProps (vm: Component, propsOptions: Object) {
111111

112112
function initData (vm: Component) {
113113
let data = vm.$options.data
114-
// $options.data is guaranteed to be a function after merge
115-
data = vm._data = getData(data, vm)
114+
data = vm._data = typeof data === 'function'
115+
? getData(data, vm)
116+
: data || {}
116117
if (!isPlainObject(data)) {
117118
data = {}
118119
process.env.NODE_ENV !== 'production' && warn(

0 commit comments

Comments
 (0)