Skip to content

v-model with uninitialized property #3732

Closed
@fergaldoyle

Description

@fergaldoyle

Vue.js version

2.0 rc

Reproduction Link

http://codepen.io/anon/pen/xEqbmN?editors=1010#0

What is Expected?

Not sure if this is what is expected in Vue 2.0. Tried to search but couldn't find anything.
e.g:

data: {
  model: {
    a: ''
  }
}
<input v-model="model.a" />
<input v-model="model.b" />

If you pass an uninitialized property (model.b) to v-model, it's obviously not reactive so bindings won't update or a deep watch on this.model won't fire off either.

Any chance that v-model could use Vue.set internally if it detects a binding with value undefined to automatically create reactive properties? (like Vue 1.0)

Or failing that, it should warn when an uninitialized property is passed to v-model

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions