diff --git a/src/App.vue b/src/App.vue index 02e4d965..f4670cc4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -30,7 +30,7 @@ import { onMounted, ref } from "vue"; import TSidebar from "./components/t-sidebar.vue"; import TBackTop from "./components/t-backTop.vue"; // tauri -import { fs, window } from "@tauri-apps/api"; +import { fs, window, app } from "@tauri-apps/api"; // store import useAppStore from "./store/modules/app"; // utils @@ -46,6 +46,8 @@ onMounted(async () => { const win = await window.getCurrent(); isMain.value = win.label === "tauri-genshin"; if (isMain.value) { + const title = "Tauri.Genshin v" + (await app.getVersion()) + " Alpha"; + await win.setTitle(title); await checkLoad(); } }); diff --git a/src/views/t-post.vue b/src/views/t-post.vue index 5590942e..369d08f2 100644 --- a/src/views/t-post.vue +++ b/src/views/t-post.vue @@ -9,6 +9,8 @@ import { ref, onMounted } from "vue"; import { useRoute } from "vue-router"; import TLoading from "../components/t-loading.vue"; +// tauri +import { appWindow } from "@tauri-apps/api/window"; // plugins import MysOper from "../plugins/Mys"; @@ -26,6 +28,7 @@ onMounted(async () => { if (!post_id) { loadingEmpty.value = true; loadingTitle.value = "未找到数据"; + await appWindow.setTitle("未找到数据"); return; } // 获取数据 @@ -34,9 +37,11 @@ onMounted(async () => { const postData = await MysOper.Post.get(post_id); loadingTitle.value = "正在渲染数据..."; postHtml.value = MysOper.Post.parser(postData); + await appWindow.setTitle(postData.post.subject); } catch (error) { loadingEmpty.value = true; loadingTitle.value = "帖子不存在或解析失败"; + await appWindow.setTitle("帖子不存在或解析失败"); return; } setInterval(() => {