创建xx.wxml文件并写入设置缓存和读取缓存的触发项
<view bindtap='f1' >设置1</view>
<view bindtap='f2' >设置2</view>
<view bindtap='f3' >设置3</view>
<view bindtap='f4' >读取4</view>
创建xx.js文件并写入触发函数,其中f1,f2,f3依次写缓存,后来者居上。f4读取缓存。
Page({
f1:function(){
try{
wx.setStorage({
key:'user_infomation',
data:{
uid:"101"
}
})
} catch (e) {
console.log(e)
}
},
f2:function(){
try{
wx.setStorage({
key:'user_infomation',
data:{
uid:"101",
openid:"xywejsotuxma823ks0k=kdq="
}
})
} catch (e) {
console.log(e)
}
},
f3:function(){
try{
wx.setStorage({
key:'user_infomation',
da