# setStorage
设置App本地存储数据,支持过期时间
# 请求参数
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
key | String | Y | - | 存储的key |
value | Any | Y | - | 存储的值,非字符串会自动JSON序列化 |
set_time | Boolean | N | false | 是否设置过期时间 |
duration | Number | N | 0 | 过期时间(小时),0表示永不过期 |
# 参数代码示例
// 永久存储通用数据
this.$bridge.setStorage('COMMON_DCP_DATA_V3', COMMON_DCP_DATA_V3)
// 设置24小时后过期
this.$bridge.setStorage('myKey', 'value', true, 24)
1
2
3
4
5
2
3
4
5