wx.setStorage设置和读取缓存是否考虑一次性多个?
//登陆成功后把用户的昵称和 头像保存到缓存里面wx.setStorage({ key: "denglu", data: "true"})wx.setStorage({ key: "nickName", data: e.detail.userInfo.nickName })wx.setStorage({ key: "avatarUrl", data: e.detail.userInfo.avatarUrl })//打印刚刚charity的缓存看看wx.getStorage({ key: 'denglu', success: function (res) { console.log("登陆缓存" + res.data) }})wx.getStorage({ key: 'avatarUrl', success: function (res) { console.log("avatarUrl缓存" + res.data) }})wx.getStorage({ key: 'nickName', success: function (res) { console.log("nickName缓存" + res.data) }}) |
每设置和读取一次缓存就必须写一个方法,
能不能考虑,一次性设置或者读取多个参数,尽量简化代码?
