🐛 修正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");
urlListener = await getDeepLink();
}
if (appStore.needResize === undefined) appStore.needResize = true;
if (appStore.needResize) await checkResize();
if (appStore.needResize !== "false") await checkResize();
await win.show();
});
@@ -85,7 +84,7 @@ async function checkResize(): Promise<void> {
function getSize(label: string): PhysicalSize {
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);
}

View File

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

View File

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