当前位置:网站首页>indexedDB本地存储,首页优化
indexedDB本地存储,首页优化
2022-06-24 09:32:00 【Time202051】
<el-button type="primary" @click="createdDB">创建数据库</el-button>
<el-button type="primary" @click="addDB">添加数据</el-button>
var db;
createdDB() {
var request = window.indexedDB.open("db", 3);
request.onsuccess = function (e) {
db = e.target.result;
console.log("数据库打开成功", db);
};
request.onupgradeneeded = function (event) {
db = event.target.result;
var objectStore;
if (!db.objectStoreNames.contains("person")) {
objectStore = db.createObjectStore("person", {
keyPath: "id" });
}
};
},
addDB() {
db.transaction(["person"], "readwrite")
.objectStore("person")
.add({
id: 0, name: "小明", age: 12 });
},

边栏推荐
- Amendment to VPP implementation policy routing
- In depth study paper reading target detection (VII) Chinese English Bilingual Edition: yolov4 optimal speed and accuracy of object detection
- 谈谈数字化转型晓知识
- [GDB debugging tool] | how to debug under multithreading, multiprocessing and running programs
- June 13-19, 2022 AI industry weekly (issue 102): career development
- Threejs point light + ambient light
- 【Eureka注册中心】
- [Eureka registry]
- ApplicationContextInitializer的三种使用方法
- 198. house raiding
猜你喜欢

Grpc local test joint debugging tool bloomrpc

二十、处理器调度(RR时间片轮转,MLFQ多级反馈队列,CFS完全公平调度器,优先级翻转;多处理器调度)

Literature Research Report

e的lnx为什么等于x

Cdga | how can we do well in data governance?

latex公式及表格识别
![[GDB debugging tool] | how to debug under multithreading, multiprocessing and running programs](/img/b5/38a53c88240c4308452d0208173461.png)
[GDB debugging tool] | how to debug under multithreading, multiprocessing and running programs

Amazing tips for using live chat to drive business sales

CDGA|到底怎么才能做好数据治理呢?

R ellipse random point generation and drawing
随机推荐
Honeypot 2 hfish, ehoney
Latex formula and table recognition
Five heart matchmaker
Learn Tai Chi Maker - esp8226 (12) esp8266 multitasking
文献调研报告
Handling method of Oracle data file header SCN inconsistency
Zero foundation self-study SQL course | related sub query
算法--找到和最大的长度为 K 的子序列(Kotlin)
Time series data augmentation for deep learning: paper reading of a survey
Practical analysis: implementation principle of APP scanning code landing (app+ detailed logic on the web side) with source code
Niuke.com string deformation
Target of cmake command_ compile_ options
达梦数据库如何定位锁等待问题解决方法
使用Live Chat促进业务销售的惊人技巧
[Eureka source code analysis]
Oracle 12c升级至19c后ORA-28000错误
每周推薦短視頻:談論“元宇宙”要有嚴肅認真的態度
Learning Tai Chi Maker - esp8226 (XIII) OTA
Literature Research Report
实战剖析:app扫码登陆实现原理(app+网页端详细逻辑)附源码