Answers for "vue watch"

13

vue watch

var vm = new Vue({
  el: '#demo',
  data: {
    firstName: 'Foo',
    lastName: 'Bar',
    fullName: 'Foo Bar'
  },
  watch: {
    firstName: function (val) {
      this.fullName = val + ' ' + this.lastName
    },
    lastName: function (val) {
      this.fullName = this.firstName + ' ' + val
    }
  }
})
Posted by: Guest on March-12-2020
0

vue watch

watch: {
  // whenever question changes, this function will run
  question(newQuestion, oldQuestion) {
    // your code
  }
},
Posted by: Guest on October-20-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language