🐛 应用初次加载也加载数据库,完善数据库 load #40

This commit is contained in:
BTMuli
2023-09-15 17:30:07 +08:00
parent a7dd069930
commit 0c2d4d0b89
2 changed files with 19 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ import { useAppStore } from "./store/modules/app";
// utils
import { getEmojis } from "./plugins/Mys/request/getEmojis";
import showSnackbar from "./components/func/snackbar";
import TGSqlite from "./plugins/Sqlite";
const appStore = useAppStore();
const isMain = ref<boolean>(false);
@@ -76,6 +77,7 @@ async function checkLoad(): Promise<void> {
return;
}
await createDataDir();
await initData();
appStore.loading = true;
console.info("数据加载完成!");
}
@@ -89,6 +91,14 @@ async function createDataDir(): Promise<void> {
}
console.info("数据文件夹创建完成!");
}
// 初始化数据库
async function initData(): Promise<void> {
await TGSqlite.reset();
showSnackbar({
text: "已成功初始化数据库!",
});
}
</script>
<style lang="css">
.app-container {