vue watch

Solutions on MaxInterview for vue watch by the best coders in the world

showing results for - "vue watch"
Amir
08 Mar 2019
1var vm = new Vue({
2  el: '#demo',
3  data: {
4    firstName: 'Foo',
5    lastName: 'Bar',
6    fullName: 'Foo Bar'
7  },
8  watch: {
9    firstName: function (val) {
10      this.fullName = val + ' ' + this.lastName
11    },
12    lastName: function (val) {
13      this.fullName = this.firstName + ' ' + val
14    }
15  }
16})
Marco
17 Apr 2019
1
2watch: {
3  // whenever question changes, this function will run
4  question(newQuestion, oldQuestion) {
5    // your code
6  }
7},
8