JSFiddle - React, Tailwind, and code Playground
A Vue field update by the timer
by BeloglazovRL
HTML
<div id="app">
{{ text }}
</div>
CSS
#app {
background-color: lightgreen;
}
Vue
new Vue({
el: "#app",
data: {
text: "Starting...",
timer: 0,
},
methods: {
myTimer() {
this.timer++;
this.text = this.timer;
if (this.timer < 10) {
setTimeout(() => {
this.myTimer();
}, 1000);
}
}
},
mounted() {
this.myTimer();
}
});