wxml中:
<view>{{msg1}}</view>
<button bind:tap='start'>开始</button>
<button bind:tap='pause'>暂停</button>
js中:
start(e) {
// console.log(this.data.msg1);
// console.log(start);
// console.log(end);
clearInterval(this.timer)
this.timer = setInterval(() => {
let start = this.data.msg1.slice(0, 1);
let end = this.data.msg1.slice(1)
this.setData({
msg1: end + start
})
}, 300)
},
pause(e) {
clearInterval(this.timer)
},