dianzan

xhml

<view catchtap="onCollectionTap" style="background:green" class="sotrge1" >读取缓存</view>
<view catchtap="onShareTap" style="background:red" class="sotrge2">移除缓存</view>

JS

//获取应用实例
// var postsData=require(\'../../data/posts-data.js\');
var app = getApp()
Page({
data: {

},
onLoad: function(option){
console.log(1);
// this.setData({
// postData:postData
// })
// 添加或修改缓存
// wx.setStorageSync("key", "喝水")
wx.setStorageSync("key", "吃饭")
},
onCollectionTap:function(event){
var game=wx.getStorageSync(\'key\')
console.log(game)
},
onShareTap:function(event){
wx.removeStorageSync(\'key\')
}
})

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-06-13
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
  • 2022-01-23
猜你喜欢
  • 2021-06-29
  • 2021-04-09
  • 2021-12-06
  • 2021-07-18
  • 2021-12-23
  • 2022-12-23
相关资源
相似解决方案