# getStorage
APP本地化存储取值
# 调用方式
getStorage(key)
1
返回 Promise,使用 then/catch 或 await 处理结果。
# 请求参数
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| key | String | Y | — | 存储键,不能为空 |
# 接口调用示例
this.$bridge.getStorage('example-key')
.then(res => {
console.log(res)
})
.catch(error => {
console.error(error)
})
1
2
3
4
5
6
7
2
3
4
5
6
7
# 返回参数
key 为空时直接返回 false;有效 key 返回 Promise,成功取得的 JSON 字符串会尝试解析。未找到数据或读取失败时 resolve(undefined)。