Skip to content

Fix v-model section #813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2017
Merged

Fix v-model section #813

merged 1 commit into from
Mar 9, 2017

Conversation

asolopovas
Copy link
Contributor

Hi,

v-model section requires extra line to make this code complete. Otherwise it causes a problem:

render: function (createElement) {
  var self = this
  return createElement('input', {
    domProps: {
      value: self.value
    },
    on: {
      input: function (event) {
        self.value = event.target.value
        // This line should be added
        self.$emit('input', event.target.value)
      }
    }
  })
}

Otherwise the value is updated in the one way. Please see example http://codepen.io/asolopovas/pen/OpWVxa?editors=1011

Hi,

v-model section requires extra line to make this code complete. Otherwise it causes a problem:
```
render: function (createElement) {
  var self = this
  return createElement('input', {
    domProps: {
      value: self.value
    },
    on: {
      input: function (event) {
        self.value = event.target.value
        // This line should be added
        self.$emit('input', event.target.value)
      }
    }
  })
}
```

Otherwise the value is updated in the one way. Please see example http://codepen.io/asolopovas/pen/OpWVxa?editors=1011
Copy link
Member

@kazupon kazupon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!
Thanks!

@kazupon kazupon merged commit 119e4d3 into vuejs:master Mar 9, 2017
kazupon pushed a commit to kazupon/vuejs.org that referenced this pull request Oct 1, 2017
Hi,

v-model section requires extra line to make this code complete. Otherwise it causes a problem:
```
render: function (createElement) {
  var self = this
  return createElement('input', {
    domProps: {
      value: self.value
    },
    on: {
      input: function (event) {
        self.value = event.target.value
        // This line should be added
        self.$emit('input', event.target.value)
      }
    }
  })
}
```

Otherwise the value is updated in the one way. Please see example http://codepen.io/asolopovas/pen/OpWVxa?editors=1011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants