From 6861eee66550e7d58fef7aa8508930de23adde23 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Wed, 23 Apr 2025 11:22:57 +0800 Subject: [PATCH] fix: indexDB --- src/utils/commons.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/commons.js b/src/utils/commons.js index b7ab611..9b2b7c3 100644 --- a/src/utils/commons.js +++ b/src/utils/commons.js @@ -599,7 +599,10 @@ export const logWebsocket = (message, direction) => { var open = indexedDB.open('LogWebsocketData', 2) open.onupgradeneeded = function () { var db = open.result - var store = db.createObjectStore('LogStore', { keyPath: 'id', autoIncrement: true }) + // 数据库是否存在 + if (!db.objectStoreNames.contains('LogStore')) { + var store = db.createObjectStore('LogStore', { keyPath: 'id', autoIncrement: true }) + } } open.onsuccess = function () { var db = open.result