setItem 设置数据内容
setItem
类型: MethodDeclaration
定义位置: data.ts
描述
设置数据内容
参数 key
: 键(存档文件名)
参数 value
: 写入的数据
参数
参数名 | 类型 | 描述 | 默认值 |
---|---|---|---|
key | string | - | - |
value | any | - | - |
返回值
类型: Promise<void>
源代码
位置: 第 1143 行
public async setItem(key: string, value: any): Promise<void> {
return new Promise(resolve => {
this.open().then(objectStore => {
const request = objectStore.put({key, value})
request.onsuccess = event => {
resolve()
}
})
})
}
文档生成时间:2025/7/7 12:07:06