refactor: ♻️ 代码优化
This commit is contained in:
parent
b24f77409a
commit
f5937eddb6
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ const props = defineProps({
|
|||
*/
|
||||
modelValue: {
|
||||
type: Array<string>,
|
||||
default: [] as Array<string>,
|
||||
default: () => [],
|
||||
},
|
||||
/**
|
||||
* 文件上传数量限制
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue