# setMiniAppCache^8.0
设置当前插件的内存缓存和磁盘缓存(支持weex插件和H5插件,需要插件中有profile.json文件,并且有moduleCode,只在插件内共享数据)
# 请求参数
Prop | Type | Default | Comment |
---|---|---|---|
type | String | 0/1 | 必传参数,0:存储在内存中 1:存储在磁盘和内存中 |
params | Object | {key1:'value1'} | e.g. {key1 : 'value1' , key1 : 'value1',...} |
说明:
- 不建议使用localStorage、sessionStrorage,页面间数据不共享
- 内存缓存:退出APP,全部内存缓存都被清除
# 接口调用示例
const params = {
"type": "0",
"params": {
name:'midea'
}
}
this.$bridge
.setMiniAppCache(params)
.then(res => {
this.$alert(res)
})
.catch(err => {
this.$toast(err)
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 接口返回示例
{
"code": 0,
"msg": "成功"
}
1
2
3
4
5
6
2
3
4
5
6