const signUrl="https://yyq2.oss-cn-shanghai.aliyuncs.com/pdf/sign.jpg" Page({ data:{ currentTime:10, }, onLoad:function(options){ // 页面初始化 options为页面跳转所带来的参数 this.shartTick() }, onReady:function(){ // 页面渲染完成 }, gotoSign(){ wx.navigateTo({ url: '/pages/tool/sign/signature', }) }, preview(){ wx.previewImage({ urls: ["https://yyq2.oss-cn-shanghai.aliyuncs.com/pdf/sign.jpg"], //预览图片 数组 }) }, shartTick:function(){ let currentTime= 10 let _this = this let interval = setInterval(function() { currentTime--; _this.setData({ currentTime}) if( currentTime <1){ clearInterval( interval ) } console.log( currentTime ) }, 1000) // 页面显示 }, onHide:function(){ // 页面隐藏 }, onUnload:function(){ // 页面关闭 } })