Data stored in the applet

What is really sincere they sound judgment by real gold, not radio waves turned the heart of the young band, there are always a few obscure land of the free will not be infringed

 

For details, see: 
HTTPS: // developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorageSync.html

 

存:
onLoad(){
      wx.setStorage({
         key: 'goods',
         data: JSON.stringify({
"goodsName" : "三只松鼠","price" : 300
}),
      })
   }

取:
onLoad(){
      wx.getStorage({
         key: 'goods',
         success: function(data) {

            console.log(JSON.parse(data.data));
{goodsName: "三只松鼠", price: 300}

         } 
      }) 
   } Delete (delete the key value): 
the onLoad () { 
wx.removeStorage ({ 
         key: 

' Goods ' , 
         Success: function (RES) { 
            the console.log (RES); 
            // {errMsg An: "removeStorage : ok "} deleted successfully return to the ok 
         }, 
      }) 
}

 

Guess you like

Origin www.cnblogs.com/home-/p/11607156.html