最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
微信小程序实现写入读取缓存的教程
时间:2022-06-25 15:22:28 编辑:袖梨 来源:一聚教程网
在小程序中有些需要把数据缓存到Storage中,需要的时候在读取缓存中的数据,在微信小程序中通过setStorage写入数据:
wx.setStorage({
key: 'myData',
data: res.data.data
})
通过getStorage读取缓存中的数据:
var that = this;
wx.getStorage({
key: 'myData',
success: function (res) {
var myData = res.data;//读取key值为myData的缓存数据
that.setData({//拿到缓存中的数据并渲染到页面
userName: myData.user.truename,
schoolName: myData.school.name,
className: myData.user.className,
}
})
相关文章
- 使命召唤黑色行动6动画师任务攻略 11-02
- 使命召唤黑色行动6失踪人员任务攻略 11-02
- 使命召唤黑色行动6敏锐的眼睛任务攻略 11-02
- 龙腾世纪4影障守护者终极技能解锁方法 11-02
- 介绍自已特长的短句话选录76条 11-02
- 龙腾世纪4影障守护者技能强化作用说明 11-02