mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
✨ 添加回正开关,默认开启
This commit is contained in:
@@ -52,7 +52,8 @@ onBeforeMount(async () => {
|
||||
await core.invoke("init_app");
|
||||
urlListener = await getDeepLink();
|
||||
}
|
||||
await checkResize();
|
||||
if (appStore.needResize === undefined) appStore.needResize = true;
|
||||
if (appStore.needResize) await checkResize();
|
||||
await win.show();
|
||||
});
|
||||
|
||||
|
||||
@@ -45,6 +45,22 @@
|
||||
/>
|
||||
</template>
|
||||
</v-list-item>
|
||||
<v-list-item title="窗口回正" subtitle="根据分辨率动态调整窗体大小">
|
||||
<template #prepend>
|
||||
<div class="config-icon">
|
||||
<v-icon>mdi-window-restore</v-icon>
|
||||
</div>
|
||||
</template>
|
||||
<template #append>
|
||||
<v-switch
|
||||
v-model="appStore.needResize"
|
||||
:label="appStore.needResize ? '开启' : '关闭'"
|
||||
:inset="true"
|
||||
color="#FAC51E"
|
||||
@click="submitResize"
|
||||
/>
|
||||
</template>
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
<template #prepend>
|
||||
<div class="config-icon">
|
||||
@@ -442,9 +458,20 @@ async function confirmResetDB(title?: string): Promise<void> {
|
||||
|
||||
// 开启 dev 模式
|
||||
function submitDevMode(): void {
|
||||
appStore.devMode
|
||||
? showSnackbar({ text: "已关闭 dev 模式!" })
|
||||
: showSnackbar({ text: "已开启 dev 模式!" });
|
||||
if (appStore.devMode) {
|
||||
showSnackbar({ text: "已关闭 dev 模式!" });
|
||||
return;
|
||||
}
|
||||
showSnackbar({ text: "已开启 dev 模式!" });
|
||||
}
|
||||
|
||||
// 开启窗口回正
|
||||
function submitResize(): void {
|
||||
if (appStore.needResize) {
|
||||
showSnackbar({ text: "已开启窗口回正!" });
|
||||
return;
|
||||
}
|
||||
showSnackbar({ text: "已关闭窗口回正!" });
|
||||
}
|
||||
|
||||
// 通过子组件的事件来控制 loading
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @file store/modules/app.ts
|
||||
* @description App store module
|
||||
* @since Beta v0.5.2
|
||||
* @since Beta v0.5.3
|
||||
*/
|
||||
|
||||
import { path } from "@tauri-apps/api";
|
||||
@@ -50,6 +50,8 @@ export const useAppStore = defineStore(
|
||||
const lang = ref<AnnoLang>("zh-cn");
|
||||
// 最近的咨讯类型
|
||||
const recentNewsType = ref("notice");
|
||||
// 是否开启分辨率回正
|
||||
const needResize = ref<boolean | undefined>(true);
|
||||
|
||||
// 初始化
|
||||
function init(): void {
|
||||
@@ -61,6 +63,7 @@ export const useAppStore = defineStore(
|
||||
server.value = AnnoServer.CN_ISLAND;
|
||||
lang.value = "zh-cn";
|
||||
recentNewsType.value = "notice";
|
||||
needResize.value = true;
|
||||
initDevice();
|
||||
}
|
||||
|
||||
@@ -87,6 +90,7 @@ export const useAppStore = defineStore(
|
||||
server,
|
||||
lang,
|
||||
recentNewsType,
|
||||
needResize,
|
||||
init,
|
||||
changeTheme,
|
||||
};
|
||||
@@ -101,7 +105,7 @@ export const useAppStore = defineStore(
|
||||
{
|
||||
key: "app",
|
||||
storage: window.localStorage,
|
||||
paths: ["devMode", "loading", "buildTime", "isLogin"],
|
||||
paths: ["devMode", "loading", "buildTime", "isLogin", "needResize"],
|
||||
},
|
||||
{
|
||||
key: "sidebar",
|
||||
|
||||
Reference in New Issue
Block a user