setGlobalAppCache
setGlobalAppCache^8.0
设置指定键的全局缓存,可以设置到内存中,还可以内存和磁盘中都保存(数据共享权限范围:app内)
#请求参数
| Prop | Type | Default | Comment |
|---|---|---|---|
| type | String | 0/1 | 必传参数,0:内存缓存 1:内存和磁盘缓存 |
| params | Object | e.g. |
说明:
- 不建议使用localStorage、sessionStrorage,页面间数据不共享
- 内存缓存:退出APP,全部内存缓存都被清除
#接口调用示例
const params = {
"type": "0",
"params": {
name:'midea'
}
}
this.$bridge
.setGlobalAppCache(params)
.then(res => {
this.$alert(res)
})
.catch(err => {
this.$toast(err)
})
#接口返回示例
{
"code": 0,
"msg": "成功"
}
浙公网安备 33010602011771号