列表渲染中怎么显示倒计时
小程序有没有filter方法,在列表渲染中,怎么显示倒计时,用wxs封装了倒计时方法一直提示setInterval is not defind
2 回复
<view class=‘returnBtn’ bindtap=“returnBtn”>返回首页({{time}})</view>
Page({
data: {
time:3,
timer:null
},
onLoad: function (options) {
this.data.timer=setInterval(()=>{
if (this.data.time==0){
clearInterval(this.data.timer)
this.returnBtn()
}else{
this.data.time–;
this.setData({
time: this.data.time
})
}
},1000)
},
returnBtn(){
clearInterval(this.data.timer)
wx.reLaunch({
url: ‘/pages/index_/index_’,
})
},
})