uniapp本地存储需要注意:vue的本地存储方式, 小程序在浏览器测试时也可以实现, 但是在真机运行时不能实现
一.保存uni.setstorage(object )
对象参数
uni.setstoragesync(key,data ) )。
try{uni.setstoragesync(token,) 123456 ) } catch (e ) e ) )//错误}2.uni.getstorage )对象)
从本地存储异步获取可支持的内容
uni.getstoragesync(key ) )。
同步从本地缓存中检索与指定key相对应的内容
try { const value=uni.getstoragesync (' token ); if(value ) console.log (value ) }catch(e ) )//错误)三. uni.removestorage ) object )删除
从本地缓存中异步删除指定的key
uni.removestoragesync(key ) )。
从本地缓存中同步删除指定的key
try { uni.removestoragesync (storage _ key ) }catch(e )//错误}