data中定义:
seconds: 60, // 倒计时
sendType: 1, // 文本类型
timer: null,//计时器
countTime() {
let seconds = this.seconds;
this.timer = setInterval(() => {
if (seconds <= 1) {
clearInterval(this.timer)
this.sendType = 1
this.seconds = 60
return;
}
this.seconds = --seconds
}, 1000);
},