setMiniAppCache
setMiniAppCache^8.0
设置当前插件的内存缓存和磁盘缓存(支持weex插件和H5插件,需要插件中有profile.json文件,并且有moduleCode,只在插件内共享数据)
#请求参数
| 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
.setMiniAppCache(params)
.then(res => {
this.$alert(res)
})
.catch(err => {
this.$toast(err)
})
#接口返回示例
{
"code": 0,
"msg": "成功"
}
浙公网安备 33010602011771号