diff --git a/package/component/src/component/menu/index.vue b/package/component/src/component/menu/index.vue index 210b5ed7..7abef206 100644 --- a/package/component/src/component/menu/index.vue +++ b/package/component/src/component/menu/index.vue @@ -19,7 +19,7 @@ export interface LayMenuProps { collapseTransition?: boolean | string; } -const emit = defineEmits(["update:selectedKey", "update:openKeys"]); +const emit = defineEmits(["update:selectedKey", "update:openKeys","changeSelectedKey","changeOpenKeys"]); const props = withDefaults(defineProps(), { selectedKey: "", @@ -43,6 +43,7 @@ const openKeys = computed({ }, set(val) { emit("update:openKeys", val); + emit("changeOpenKeys", val); }, }); @@ -52,6 +53,7 @@ const selectedKey = computed({ }, set(val) { emit("update:selectedKey", val); + emit("changeSelectedKey", val); }, }); @@ -59,12 +61,10 @@ watch( () => props.collapse, () => { if (props.collapse) { - // 删除所有打开 oldOpenKeys.value = props.openKeys; - emit("update:openKeys", []); + openKeys.value = []; } else { - // 赋值所有打开 - emit("update:openKeys", oldOpenKeys.value); + openKeys.value = oldOpenKeys.value; } }, { immediate: true } diff --git a/package/component/src/provider/index.vue b/package/component/src/provider/index.vue index 843c30db..2a68965e 100644 --- a/package/component/src/provider/index.vue +++ b/package/component/src/provider/index.vue @@ -8,10 +8,10 @@ export default { import { watch } from "vue"; import { useI18n } from "vue-i18n"; import { - enable as enableDarkMode, - disable as disableDarkMode, Theme, DynamicThemeFix, + enable as enableDarkMode, + disable as disableDarkMode, } from "darkreader"; const { locale, setLocaleMessage, mergeLocaleMessage } = useI18n(); @@ -60,9 +60,7 @@ const changeTheme = (theme: string) => { "div.layui-color-picker *", ], }; - Object.assign(defaultPartial, props.darkPartial); - if (theme === "dark") { enableDarkMode(defaultPartial, defaultFixes); } else if (theme === "light") {