[Vuejs]-Vue.js – cannot assign new value to property using keyup.enter event on input binded to that property

0πŸ‘

The code you present above works as expected (even without data being pre-set). There must be some other issue at work.

new Vue({
  el: 'body',
  methods: {
    clear: function() {
      this.something1 = null;
      this.something2 = null;
    }
  }
});
<script src="//cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.min.js"></script>
<input type="text" v-model="something1" @keyup.enter="clear">
<input type="text" v-model="something2" @keyup.enter="clear">

Leave a comment