本教程操作环境:windows7系统、uni-app2.5.1版本,dell g3电脑,该方法适用于所有品牌电脑。
推荐(免费):uni-app开发教程
uniapp同步缓存失效的解决办法:
存
try { uni.setstoragesync('storage_key', 'hello');} catch (e) { // error};
取
try { const value = uni.getstoragesync('storage_key'); if (value) { console.log(value); }} catch (e) { // error};
获取当前 storage 的相关信息
try { const res = uni.getstorageinfosync(); console.log(res.keys); console.log(res.currentsize); console.log(res.limitsize);} catch (e) { // error};
移除指定key
try { uni.removestoragesync('storage_key');} catch (e) { // error};
清除本地数据缓存
try { uni.clearstoragesync();} catch (e) { // error};
相关免费学习推荐:编程视频
以上就是uniapp同步缓存失效怎么办的详细内容。