🐛 修正label&子窗口回正异常

This commit is contained in:
目棃
2024-09-06 12:20:50 +08:00
parent 599f9273e2
commit ee9f9b7acd
3 changed files with 11 additions and 10 deletions

View File

@@ -52,8 +52,7 @@ onBeforeMount(async () => {
await core.invoke("init_app"); await core.invoke("init_app");
urlListener = await getDeepLink(); urlListener = await getDeepLink();
} }
if (appStore.needResize === undefined) appStore.needResize = true; if (appStore.needResize !== "false") await checkResize();
if (appStore.needResize) await checkResize();
await win.show(); await win.show();
}); });
@@ -85,7 +84,7 @@ async function checkResize(): Promise<void> {
function getSize(label: string): PhysicalSize { function getSize(label: string): PhysicalSize {
if (label === "TeyvatGuide") return new PhysicalSize(1600, 900); if (label === "TeyvatGuide") return new PhysicalSize(1600, 900);
if (label === "Sub_Window" || label === "Dev_JSON") return new PhysicalSize(960, 720); if (label === "Sub_window" || label === "Dev_JSON") return new PhysicalSize(960, 720);
return new PhysicalSize(1280, 720); return new PhysicalSize(1280, 720);
} }

View File

@@ -53,8 +53,8 @@
</template> </template>
<template #append> <template #append>
<v-switch <v-switch
v-model="appStore.needResize" v-model="needResize"
:label="appStore.needResize ? '开启' : '关闭'" :label="needResize ? '开启' : '关闭'"
:inset="true" :inset="true"
color="#FAC51E" color="#FAC51E"
@click="submitResize" @click="submitResize"
@@ -144,6 +144,7 @@ const loading = ref<boolean>(true);
const loadingTitle = ref<string>("正在加载..."); const loadingTitle = ref<string>("正在加载...");
const loadingSub = ref<string>(""); const loadingSub = ref<string>("");
const showReset = ref<boolean>(false); const showReset = ref<boolean>(false);
const needResize = ref<boolean>(appStore.needResize !== "false");
const cacheSize = ref<number>(0); const cacheSize = ref<number>(0);
@@ -174,7 +175,7 @@ async function confirmBackup(): Promise<void> {
return; return;
} }
let saveDir = appStore.userDir; let saveDir = appStore.userDir;
if (res === false) { if (!res) {
const dir: string | null = await open({ const dir: string | null = await open({
directory: true, directory: true,
defaultPath: saveDir, defaultPath: saveDir,
@@ -214,7 +215,7 @@ async function confirmRestore(): Promise<void> {
return; return;
} }
let saveDir = appStore.userDir; let saveDir = appStore.userDir;
if (resConfirm === false) { if (!resConfirm) {
const dir: string | null = await open({ const dir: string | null = await open({
directory: true, directory: true,
defaultPath: saveDir, defaultPath: saveDir,
@@ -474,7 +475,8 @@ function submitDevMode(): void {
// 开启窗口回正 // 开启窗口回正
function submitResize(): void { function submitResize(): void {
if (appStore.needResize) { appStore.needResize = (!needResize.value).toString();
if (needResize.value) {
showSnackbar({ text: "已关闭窗口回正!" }); showSnackbar({ text: "已关闭窗口回正!" });
return; return;
} }

View File

@@ -51,7 +51,7 @@ export const useAppStore = defineStore(
// 最近的咨讯类型 // 最近的咨讯类型
const recentNewsType = ref("notice"); const recentNewsType = ref("notice");
// 是否开启分辨率回正 // 是否开启分辨率回正
const needResize = ref<boolean | undefined>(true); const needResize = ref<string>("true");
// 初始化 // 初始化
function init(): void { function init(): void {
@@ -63,7 +63,7 @@ export const useAppStore = defineStore(
server.value = AnnoServer.CN_ISLAND; server.value = AnnoServer.CN_ISLAND;
lang.value = "zh-cn"; lang.value = "zh-cn";
recentNewsType.value = "notice"; recentNewsType.value = "notice";
needResize.value = true; needResize.value = "true";
initDevice(); initDevice();
} }