//app.js // e:数据的名字 t:数据 n:是否显示日期(有数字则显示,否则不显示)
setCache:function(e, t, n){var o =+newDate()/1e3,//当前时间字符串
a =!0,// true
i ={
setime: n ?parseInt(o)+parseInt(n):0,//当n有值的时候设置创建时间
value: t // 要保存的数据};try{
wx.setStorageSync(e, i);}catch(e){//如果没有e就返回false ;
a =!1;}return a;},
二、获取缓存的函数
//app.js
getCache:function(e, t){var n =+newDate()/1e3,
o ="";
n =parseInt(n);try{
o = wx.getStorageSync(e)}catch(e){
o =void0=== t ?"": t;}return o ||"";},
三、删除缓存的函数
//app.js
removeCache:function(e){var t =!0;try{
wx.removeStorageSync(e);}catch(e){
t =!1;}return t;},
设置缓存,获取缓存,删除缓存函数的封装一、设置缓存的函数//app.js // e:数据的名字 t:数据 n:是否显示日期(有数字则显示,否则不显示) setCache: function (e, t, n) { var o = +new Date() / 1e3,//当前时间字符串 a = !0, // true i = { setime: n ...