跳到主要内容

getItem 获取数据内容

getItem

类型: MethodDeclaration

定义位置: data.ts

描述

获取数据内容

参数 key: 键(存档文件名)

返回值:读取的数据

参数

参数名类型描述默认值
keystring--

返回值

类型: Promise<any>

读取的数据

源代码

位置: 第 1127 行

public async getItem(key: string): Promise<any> {
return new Promise(resolve => {
this.open().then(objectStore => {
const request = objectStore.get(key)
request.onsuccess = (event: any) => {
resolve(event.target.result?.value)
}
})
})
}

文档生成时间:2025/7/7 12:07:06