vuejs watch data code example
Example 1: vue add watcher
vm.$watch('person.name.firstName', function(newValue, oldValue) {
alert('First name changed from ' + oldValue + ' to ' + newValue + '!');
});
Example 2: vue watch
// in component
methods: {
reverseMessage: function () {
return this.message.split('').reverse().join('')
}
}