<script>
var app=new Vue({
el:"#app",
data:{
title:"9999",
msg:"猥琐发育,别浪",
interval:null,
},
methods:{
lang:function(){
//定时器不为空的时候执行
if(this.interval!=null){return;}
this.interval=setInterval(() => {
var start=this.msg.substring(0,1);
var end=this.msg.substring(1)
this.msg=end+start
console.log(this.msg)
},100)
},
remove:function(){
clearInterval( this.interval);
//每当清除去定时器的时候需要把定时器改成null
this.interval=null
}
}
})
</script>