2👍
✅
You can try to instead create data property currentTime
:
data() {
return {
currentTime: 0
}
},
Then on mounted hook set interval, update and watch currentTime
from data:
mounted: function () {
window.setInterval(() => {
this.currentTime = new Date()
}, 1000)
},
watch: {
async currentTime(newValue, oldValue) {
...
Source:stackexchange.com