Skip to content

Commit 43551b4

Browse files
HcySunYangyyx990803
authored andcommitted
refactor: remove unnecessary checks (#7875)
1 parent 7b38739 commit 43551b4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/core/instance/state.js

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

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

0 commit comments

Comments
 (0)