JSFiddle - React, Tailwind, and code Playground
HTML
<div id="vue">
<input v-model="period">{{count}}
</div>
JavaScript
new Vue({
el:'#vue',
data:{
period:500,
count:0,
interval:undefined
},
watch:{
period:{
handler(val){
clearInterval(this.interval)
this.interval = setInterval(()=> this.count++, val)
},
immediate:true
}
}
})