0👍
Use Computed Properties
instead of making a method to perform a one-time operation.
<div id="app">
<h1>{{test}}</h1>
<div>
<h2>{{count}}</h2>
</div>
</div>
computed: {
test() {
console.log('I got rerenderd!')
return 'Hello'
}
},
methods: {
startCount() {
setInterval(() => {
this.count++;
}, 1000)
}
},
https://jsfiddle.net/Jokerwin/tnvcyw1d/3/
See more in the docs: https://v2.vuejs.org/v2/guide/computed.html
Source:stackexchange.com