vue add watcher dynamically code example
Example 1: vue dynamic create watch
vm.$watch('counter', function(newValue, oldValue) {
alert('Counter changed from ' + oldValue + ' to ' + newValue + '!');
});
Example 2: vue add watcher
vm.$watch('person.name.firstName', function(newValue, oldValue) {
alert('First name changed from ' + oldValue + ' to ' + newValue + '!');
});