mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
fix(title): window.appWindow.setTitle
This commit is contained in:
@@ -30,7 +30,7 @@ import { onMounted, ref } from "vue";
|
|||||||
import TSidebar from "./components/t-sidebar.vue";
|
import TSidebar from "./components/t-sidebar.vue";
|
||||||
import TBackTop from "./components/t-backTop.vue";
|
import TBackTop from "./components/t-backTop.vue";
|
||||||
// tauri
|
// tauri
|
||||||
import { fs, window } from "@tauri-apps/api";
|
import { fs, window, app } from "@tauri-apps/api";
|
||||||
// store
|
// store
|
||||||
import useAppStore from "./store/modules/app";
|
import useAppStore from "./store/modules/app";
|
||||||
// utils
|
// utils
|
||||||
@@ -46,6 +46,8 @@ onMounted(async () => {
|
|||||||
const win = await window.getCurrent();
|
const win = await window.getCurrent();
|
||||||
isMain.value = win.label === "tauri-genshin";
|
isMain.value = win.label === "tauri-genshin";
|
||||||
if (isMain.value) {
|
if (isMain.value) {
|
||||||
|
const title = "Tauri.Genshin v" + (await app.getVersion()) + " Alpha";
|
||||||
|
await win.setTitle(title);
|
||||||
await checkLoad();
|
await checkLoad();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
import { useRoute } from "vue-router";
|
||||||
import TLoading from "../components/t-loading.vue";
|
import TLoading from "../components/t-loading.vue";
|
||||||
|
// tauri
|
||||||
|
import { appWindow } from "@tauri-apps/api/window";
|
||||||
// plugins
|
// plugins
|
||||||
import MysOper from "../plugins/Mys";
|
import MysOper from "../plugins/Mys";
|
||||||
|
|
||||||
@@ -26,6 +28,7 @@ onMounted(async () => {
|
|||||||
if (!post_id) {
|
if (!post_id) {
|
||||||
loadingEmpty.value = true;
|
loadingEmpty.value = true;
|
||||||
loadingTitle.value = "未找到数据";
|
loadingTitle.value = "未找到数据";
|
||||||
|
await appWindow.setTitle("未找到数据");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 获取数据
|
// 获取数据
|
||||||
@@ -34,9 +37,11 @@ onMounted(async () => {
|
|||||||
const postData = await MysOper.Post.get(post_id);
|
const postData = await MysOper.Post.get(post_id);
|
||||||
loadingTitle.value = "正在渲染数据...";
|
loadingTitle.value = "正在渲染数据...";
|
||||||
postHtml.value = MysOper.Post.parser(postData);
|
postHtml.value = MysOper.Post.parser(postData);
|
||||||
|
await appWindow.setTitle(postData.post.subject);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
loadingEmpty.value = true;
|
loadingEmpty.value = true;
|
||||||
loadingTitle.value = "帖子不存在或解析失败";
|
loadingTitle.value = "帖子不存在或解析失败";
|
||||||
|
await appWindow.setTitle("帖子不存在或解析失败");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user