When you need to force an update you can either reload or re-render. Is it possible in Vue.js? how?. It is possible to re-render update in Vue.js. We will see how to re-render or reload in Vue.js. There is a simple way. You don’t have to create any variables for this. Just do:
Another method is to put all the properties which failed to refresh automatically into computed properties. Expressions are very convenient in templates but they must be used for simple operations. If you put too much complicated logics in the template it will become fat and hard to maintain. For any complex logics you have to use computed property.
Original message: "{{ message }}"
Computed reversed message: "{{ reversedMessage }}"
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('')
}
}
})
Result of this will be:
Computed reversed message: “olleH”Read more