♻️ 姑且能跑 dev,尚需调试功能

This commit is contained in:
目棃
2024-07-02 23:05:33 +08:00
parent 1214501691
commit 367307029b
66 changed files with 12626 additions and 2887 deletions

View File

@@ -9,7 +9,7 @@
</template>
<script lang="ts" setup>
import { event } from "@tauri-apps/api";
import { UnlistenFn, Event } from "@tauri-apps/api/helpers/event";
import { UnlistenFn, Event } from "@tauri-apps/api/event";
import { computed, onMounted, onUnmounted } from "vue";
import { useAppStore } from "../../store/modules/app.js";
@@ -25,8 +25,8 @@ const themeGet = computed({
});
let themeListener: UnlistenFn;
onMounted(async () => {
themeListener = await listenOnTheme();
onMounted(() => {
themeListener = listenOnTheme();
});
async function switchTheme(): Promise<void> {
@@ -34,8 +34,8 @@ async function switchTheme(): Promise<void> {
await event.emit("readTheme", themeGet.value);
}
async function listenOnTheme(): Promise<UnlistenFn> {
return await event.listen("readTheme", (e: Event<string>) => {
function listenOnTheme(): UnlistenFn {
return event.listen("readTheme", (e: Event<string>) => {
const theme = e.payload;
themeGet.value = theme === "default" ? "default" : "dark";
});