refactor: ♻️ 代码优化

This commit is contained in:
hxr 2023-09-04 22:54:13 +08:00
parent b24f77409a
commit f5937eddb6
4 changed files with 11 additions and 24 deletions

View File

@ -57,6 +57,7 @@
"screenfull": "^6.0.0",
"sockjs-client": "1.6.1",
"sortablejs": "^1.15.0",
"terser": "^5.19.3",
"stompjs": "^2.3.3",
"vue": "^3.3.4",
"vue-i18n": "9.2.2",

View File

@ -40,7 +40,7 @@ const props = defineProps({
*/
modelValue: {
type: Array<string>,
default: [] as Array<string>,
default: () => [],
},
/**
* 文件上传数量限制

View File

@ -6,31 +6,14 @@ import IconEpSunny from "~icons/ep/sunny";
import IconEpMoon from "~icons/ep/moon";
import { useRoute } from "vue-router";
import defaultSettings from "@/settings";
/**
* 暗黑模式
*/
const route = useRoute();
const settingsStore = useSettingsStore();
const permissionStore = usePermissionStore();
const appStore = useAppStore();
const isDark = useDark();
console.log("isDark1", isDark.value);
watch(
() => defaultSettings.theme,
(newVal: string) => {
if (
(newVal == "dark" && isDark.value == false) ||
(newVal == "light" && isDark.value == true)
) {
toggleDark();
console.log("isDark2", isDark.value);
}
}
);
computed(() => {});
const toggleDark = () => useToggle(isDark);
function findOutermostParent(tree: any[], findName: string) {
@ -66,7 +49,7 @@ const againActiveTop = (newVal: string) => {
appStore.changeTopActive(parent.path);
}
};
const route = useRoute();
/**
* 切换布局
*/
@ -98,6 +81,9 @@ function changeThemeColor(color: string) {
onMounted(() => {
window.document.body.setAttribute("layout", settingsStore.layout);
const theme =
localStorage.getItem("vueuse-color-scheme") || defaultSettings.theme;
localStorage.setItem("vueuse-color-scheme", theme);
});
</script>

View File

@ -48,8 +48,8 @@ const defaultSettings: DefaultSettings = {
tagsView: true,
fixedHeader: false,
sidebarLogo: true,
layout: "mix", // 默认混合模式
theme: "dark", // 默认暗黑模式
layout: "left", // 默认左侧模式
theme: "light", // 默认暗黑模式
size: "default",
language: "zh-cn",
};