# setGlobalAppCache^8.0

设置指定键的全局缓存,可以设置到内存中,还可以内存和磁盘中都保存(数据共享权限范围:app内)

# 请求参数

Prop Type Default Comment
type String 0/1 必传参数,0:内存缓存 1:内存和磁盘缓存
params Object {key1:'value1'} e.g. {key1 : 'value1' , key1 : 'value1',...}

说明:

  1. 不建议使用localStorage、sessionStrorage,页面间数据不共享
  2. 内存缓存:退出APP,全部内存缓存都被清除

# 接口调用示例

const params = {
    "type": "0",
    "params": {
        name:'midea'
    }	
}
this.$bridge
  .setGlobalAppCache(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

# 接口返回示例

{
    "code": 0,
    "msg": "成功"
}


1
2
3
4
5
6
Last Updated: 3/11/2022, 3:44:19 PM