网友真实露脸自拍10p,成人国产精品秘?久久久按摩,国产精品久久久久久无码不卡,成人免费区一区二区三区

小程序模板網(wǎng)

微信小程序緩存:本地緩存,同步緩存,異步緩存

發(fā)布時間:2017-11-27 17:36 所屬欄目:小程序開發(fā)教程

關(guān)于本地緩存1.wx.setStorage(wx.setStorageSync)、wx.getStorage(wx.getStorageSync)、wx.clearStorage(wx.clearStorageSync)可以對本地緩存進(jìn)行設(shè)置、獲取和清理。本地緩存最大為10 ...

 
 
 


關(guān)于本地緩存

1.wx.setStorage(wx.setStorageSync)、wx.getStorage(wx.getStorageSync)、wx.clearStorage(wx.clearStorageSync)可以對本地緩存進(jìn)行設(shè)置、獲取和清理。本地緩存最大為10MB

2.localStorage 是永久存儲

一、異步緩存

wx.setStorage(OBJECT)

將數(shù)據(jù)存儲在本地緩存中指定的 key 中,會覆蓋掉原來該 key 對應(yīng)的內(nèi)容

 

		
  1. wx.setStorage({
  2.  
  3. key:"key",
  4.  
  5. data:"value"
  6.  
  7. })

wx.getStorage(OBJECT)

從本地緩存中異步獲取指定 key 對應(yīng)的內(nèi)容。

 

		
  1. wx.getStorage({
  2.  
  3. key: 'key',
  4.  
  5. success: function(res) {
  6.  
  7. console.log(res.data)
  8.  
  9. }
  10.  
  11. })

wx.getStorageInfo(OBJECT)

異步獲取當(dāng)前storage的相關(guān)信息

 

		
  1. wx.getStorageInfo({
  2.  
  3. success: function(res) {
  4.  
  5. console.log(res.keys)
  6.  
  7. console.log(res.currentSize)
  8.  
  9. console.log(res.limitSize)
  10.  
  11. }
  12.  
  13. })

wx.removeStorage(OBJECT)

從本地緩存中異步移除指定 key 。

 

		
  1. wx.removeStorage({
  2.  
  3. key: 'key',


易優(yōu)小程序(企業(yè)版)+靈活api+前后代碼開源 碼云倉庫:starfork
本文地址:http://www.xiuhaier.com/wxmini/doc/course/17955.html 復(fù)制鏈接 如需定制請聯(lián)系易優(yōu)客服咨詢:800182392 點擊咨詢
QQ在線咨詢
AI智能客服 ×