Answers for "perform an action when a data changes in vue"

13

perform an action when a data changes in vue

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

Code answers related to "perform an action when a data changes in vue"

Code answers related to "Javascript"

Browse Popular Code Answers by Language