Page({
data: {
testnum:""//设置测试参数
},
test:function(){
var Num = this.data.testnum;
wx.setStorage({//存储到本地
key:"testNum",
data:Num
})
}
})
Page({
data: {
testnum:""//设置测试参数
},
onLoad:function(option){
var that = this,
wx.getStorage({//获取本地缓存
key:"testNum",
success:function(res){
that.setData({
testnum:res.data
)};
},
})
}
})
Page({
data: {
testnum:""//设置测试参数
},
onLoad:function(option){
var num = wx.getStorageSync('testNum');//wx.getStorageSync(key),获取本地缓存
this.setData({
testnum: num
});
}
})