[TOC]
# 点击即动
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17-beta.0/vue.js"></script>
</head>
<body>
<div id="app">
<input type="button" value="浪起来" @click="lang">
<input type="button" value="低调" @click="stop">
<h4>{{msg}}</h4>
</div>
<script>
new Vue({
el:'#app',
data:{
msg:"jinijifienfidfihinih",
timer:null
},
methods:{
lang:function(){
if(this.timer != null){
return
}
this.timer = setInterval(()=>{
var start=this.msg.substring(0,1);//截取第一个字
var end = this.msg.substring(1);//截取剩下字
this.msg = end+start;//拼接起来
},300)
},
stop:function(){
clearInterval(this.timer);//清楚定时器
this.timer = null;
}
}
})
</script>
</body>
</html>
```