From 3b36b19d016b5d6199cdfcbf0385be1ca5a3bca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E8=80=81=E7=99=BD=E5=85=94?= Date: Thu, 23 Oct 2025 18:56:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0TypeScript=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=92=8CVite=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E8=B7=AF=E5=BE=84=E5=88=AB=E5=90=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=EF=BC=8C=E5=90=8C=E6=97=B6=E4=BC=98=E5=8C=96=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E5=88=9D=E5=A7=8B=E5=8C=96=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E5=8D=87=E4=BB=A3=E7=A0=81=E5=8F=AF=E8=AF=BB?= =?UTF-8?q?=E6=80=A7=E5=92=8C=E7=BB=93=E6=9E=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Touchkebao/src/main.tsx | 17 ++++------------- Touchkebao/tsconfig.json | 3 ++- Touchkebao/vite.config.ts | 1 + 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Touchkebao/src/main.tsx b/Touchkebao/src/main.tsx index c1fe6c20..24238f27 100644 --- a/Touchkebao/src/main.tsx +++ b/Touchkebao/src/main.tsx @@ -7,25 +7,16 @@ import dayjs from "dayjs"; import "dayjs/locale/zh-cn"; import App from "./App"; import "./styles/global.scss"; -import { db } from "@/utils/db"; // 引入数据库实例 +import { db } from "./utils/db"; // 引入数据库实例 // 设置dayjs为中文 dayjs.locale("zh-cn"); // 数据库初始化 async function initializeApp() { - try { - // 确保数据库已打开 - await db.open(); - - await db.kfUsers.clear(); - await db.weChatGroup.clear(); - await db.contracts.clear(); - await db.newContractList.clear(); - } catch (error) { - console.error("数据库初始化失败:", error); - // 可以选择显示错误提示或使用降级方案 - } + // 确保数据库已打开 + await db.open(); + console.log("数据库初始化成功"); // 渲染应用 const root = createRoot(document.getElementById("root")!); diff --git a/Touchkebao/tsconfig.json b/Touchkebao/tsconfig.json index f6e4f581..5d6d8515 100644 --- a/Touchkebao/tsconfig.json +++ b/Touchkebao/tsconfig.json @@ -20,7 +20,8 @@ "@/*": ["src/*"], "@weChatStore/*": ["src/store/module/weChat/*"], "@storeModule/*": ["src/store/module/*"], - "@apiModule/*": ["src/api/module/*"] + "@apiModule/*": ["src/api/module/*"], + "@utils/*": ["src/utils/*"] } }, "include": ["src"] diff --git a/Touchkebao/vite.config.ts b/Touchkebao/vite.config.ts index 1730de58..1431a796 100644 --- a/Touchkebao/vite.config.ts +++ b/Touchkebao/vite.config.ts @@ -10,6 +10,7 @@ export default defineConfig({ "@storeModule": path.resolve("src/store/module/"), "@weChatStore": path.resolve("src/store/module/weChat"), "@apiModule": path.resolve("src/api/module/"), + "@utils": path.resolve("src/utils/"), }, }, server: {