<div id="app">
<input type="button" value="浪起来" @click="lang">
<input type="button" value="低调" @click="stop">
<h3 v-cloak>
{{msg}}
</h3>
</div>
<script>
var vm = new Vue ({
el : '#app',
data : {
msg : '猥琐发育,别浪~~~',
intervalId : null
},
methods : {
lang () {
this.intervalId = setInterval(() => {
var start = this.msg.substring(0,1)
var end = this.msg.substring(1)
this.msg = end + start
}, 400)
},
stop () {
clearInterval(this.intervalId)
}
}
})
</script>
来源:CSDN
作者:这个东西不好和你解释,因为我是菜狗
链接:https://blog.csdn.net/weixin_43912756/article/details/104175474