var vm = new Vue({ el: '#example', data: { message: 'Hello' }, computed: { // a computed getter reversedMessage: function () { // `this` points to the vm instance return this.message.split('').reverse().join('') } } })
vm.$watch('person.name.firstName', function(newValue, oldValue) { alert('First name changed from ' + oldValue + ' to ' + newValue + '!'); });