优化: 将本地存储从localStorage迁移至IndexedDB以支持更大数据量存储

This commit is contained in:
yuantao
2025-10-17 10:17:49 +08:00
parent ae375aee8c
commit 0a89eda20b
9 changed files with 505 additions and 530 deletions

View File

@@ -13,6 +13,9 @@ import FolderPage from './pages/FolderPage.vue'
// 设置页面
import SettingsPage from './pages/SettingsPage.vue'
// 导入数据库初始化函数
import { initDB } from './utils/indexedDBStorage'
// 配置路由规则
// 定义应用的所有路由路径和对应的组件
const routes = [
@@ -42,6 +45,16 @@ const router = createRouter({
// 创建并挂载Vue应用实例
// 配置Pinia状态管理和Vue Router路由
const app = createApp(App)
// 初始化数据库
initDB().then(() => {
console.log('数据库初始化成功')
}).catch(error => {
console.error('数据库初始化失败:', error)
// 即使数据库初始化失败,也继续启动应用
// 这样可以确保应用在没有IndexedDB支持的环境中仍然可以运行
})
// 使用Pinia进行状态管理
app.use(createPinia())
// 使用Vue Router进行路由管理