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 yyx990803 committed Mar 22, 2018
1 parent 7b38739 commit 43551b4
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 43551b4

Please sign in to comment.