title: Taro.getStorageInfoSync()
sidebar_label: getStorageInfoSync
Taro.getStorageInfo 的同步版本
支持情况:
类型
() => Option
参数
Option
参数 | 类型 | 说明 |
---|---|---|
currentSize | number |
当前占用的空间大小, 单位 KB |
keys | string[] |
当前 storage 中所有的 key |
limitSize | number |
限制的空间大小,单位 KB |
示例代码
try {
const res = Taro.getStorageInfoSync()
console.log(res.keys)
console.log(res.currentSize)
console.log(res.limitSize)
} catch (e) {
// Do something when catch error
}