Skip to content

Commit

Permalink
refactor: remove unnecessary checks (vuejs#7875)
Browse files Browse the repository at this point in the history
  • Loading branch information
HcySunYang authored and hefeng committed Jan 25, 2019
1 parent 4c3c5a5 commit 4025c1c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/instance/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ function initProps (vm: Component, propsOptions: Object) {

function initData (vm: Component) {
let data = vm.$options.data
data = vm._data = typeof data === 'function'
? getData(data, vm)
: data || {}
// $options.data is guaranteed to be a function after merge
data = vm._data = getData(data, vm)
if (!isPlainObject(data)) {
data = {}
process.env.NODE_ENV !== 'production' && warn(
Expand Down

0 comments on commit 4025c1c

Please sign in to comment.