// logs.js const util = require('../../utils/util.js') Page({ data: { logs: [] }, onSaveExitState: function() { wx.clearStorage(); console.log("onSaveExitState="); // 返回保存的数据和超时时间(可选) return { expireTimeStamp: Date.now() + 24 * 60 * 60 * 1000 // 超时时间戳,例如设置为1天后过期 }; }, //扫码 tapScan(){ wx.scanCode({ success: function(res) { console.log('扫码获取的参数',res); wx.clearStorage(); wx.setStorageSync('res',res); wx.reLaunch({ url: '/pages/index/index?res='+res,//传res }) } }) }, onLoad() { console.log("scan页面"); // this.setData({ // logs: (wx.getStorageSync('logs') || []).map(log => { // return util.formatTime(new Date(log)) // }) // }) // wx.clearStorage(); } })