关于缓存getStorage的问题?

小程序 文章 2021-03-13 22:41 0 29 全屏看文

关于缓存getStorage的问题?Questions about caching getStorage?

关于缓存getStorage的问题?

 

 明明没有通过wx.setStorage({})方法,设置key: "lemonKey",而直接通过 wx.getStorage({ key: "lemonKey",xxxx})方法获取值,为什么可以成功?

不使用wx.setStorage({}),而直接wx.getStorage({}),为啥能成功,求解

 wx.getStorage({

           key: "lemonKey",

           success: function (res) {

           t_point = res.data

           },

           fail: function () {

             that.ds()

             t_point = wx.getStorageSync( "lemonKey")

           }

    })




Clearly did not pass wx.setStorage ({}) method, set key: "lemonkey", and directly through the wx.getStorage ({key: "lemonkey", XXXX}) method to get the value, why can it succeed? Not used wx.setStorage ({}), but directly wx.getStorage ({}), why can we succeed, and how to solve it wx.getStorage ({ key: "lemonKey", success: function (res) { t_ point = res.data }, fail: function () { that.ds () t_ point = wx.getStorageSync ( "lemonKey") } })

回答:

星光刀锋:

跨商通:

看一下storage里有没有这个key呗。

-EOF-