您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

uniapp同步缓存失效怎么办

2024/2/27 19:09:48发布12次查看
uniapp同步缓存失效的解决办法:1、设置存,代码为【uni.setstoragesync('storage_key', 'hello')】;2、获取当前storage的相关信息,代码为【console.log(res.keys)】。
本教程操作环境: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同步缓存失效怎么办的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product