vue watcher confirg code example
Example 1: vue computed
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('')
}
}
})
Example 2: vue watch
// in component
methods: {
reverseMessage: function () {
return this.message.split('').reverse().join('')
}
}