diff --git a/packages/@core/ui-kit/layout-ui/src/vben-layout.vue b/packages/@core/ui-kit/layout-ui/src/vben-layout.vue index 2e2c981c913..7fd4dd77ed8 100644 --- a/packages/@core/ui-kit/layout-ui/src/vben-layout.vue +++ b/packages/@core/ui-kit/layout-ui/src/vben-layout.vue @@ -184,9 +184,6 @@ const headerFixed = computed(() => { }); const showSidebar = computed(() => { - // if (isMixedNav.value && !props.sideHidden) { - // return false; - // } return isSideMode.value && sidebarEnable.value; }); diff --git a/packages/effects/layouts/src/basic/header/header.vue b/packages/effects/layouts/src/basic/header/header.vue index 3febc93aab8..d2016ed1ffc 100644 --- a/packages/effects/layouts/src/basic/header/header.vue +++ b/packages/effects/layouts/src/basic/header/header.vue @@ -27,6 +27,8 @@ withDefaults(defineProps<Props>(), { theme: 'light', }); +const emit = defineEmits<{ clearPreferencesAndLogout: [] }>(); + const accessStore = useAccessStore(); const { globalSearchShortcutKey, preferencesButtonPosition } = usePreferences(); const slots = useSlots(); @@ -90,6 +92,10 @@ const leftSlots = computed(() => { }); return list.sort((a, b) => a.index - b.index); }); + +function clearPreferencesAndLogout() { + emit('clearPreferencesAndLogout'); +} </script> <template> @@ -123,7 +129,10 @@ const leftSlots = computed(() => { </template> <template v-else-if="slot.name === 'preferences'"> - <PreferencesButton class="mr-2" /> + <PreferencesButton + class="mr-2" + @clear-preferences-and-logout="clearPreferencesAndLogout" + /> </template> <template v-else-if="slot.name === 'theme-toggle'"> <ThemeToggle class="mr-2 mt-[2px]" /> diff --git a/packages/effects/layouts/src/basic/layout.vue b/packages/effects/layouts/src/basic/layout.vue index becf7aa0c4e..f09b51e5ae5 100644 --- a/packages/effects/layouts/src/basic/layout.vue +++ b/packages/effects/layouts/src/basic/layout.vue @@ -202,7 +202,10 @@ const headerSlots = computed(() => { </template> <!-- 头部区域 --> <template #header> - <LayoutHeader :theme="theme"> + <LayoutHeader + :theme="theme" + @clear-preferences-and-logout="clearPreferencesAndLogout" + > <template v-if="!showHeaderNav && preferences.breadcrumb.enable" #breadcrumb diff --git a/packages/effects/layouts/src/widgets/preferences/preferences-button.vue b/packages/effects/layouts/src/widgets/preferences/preferences-button.vue index 301e6454178..e277ff15503 100644 --- a/packages/effects/layouts/src/widgets/preferences/preferences-button.vue +++ b/packages/effects/layouts/src/widgets/preferences/preferences-button.vue @@ -3,9 +3,15 @@ import { Settings } from '@vben/icons'; import { VbenIconButton } from '@vben-core/shadcn-ui'; import Preferences from './preferences.vue'; + +const emit = defineEmits<{ clearPreferencesAndLogout: [] }>(); + +function clearPreferencesAndLogout() { + emit('clearPreferencesAndLogout'); +} </script> <template> - <Preferences> + <Preferences @clear-preferences-and-logout="clearPreferencesAndLogout"> <VbenIconButton> <Settings class="size-4" /> </VbenIconButton> diff --git a/packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue b/packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue index a98ad52726e..e6faa1303e8 100644 --- a/packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue +++ b/packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue @@ -413,7 +413,6 @@ async function handleReset() { variant="ghost" @click="handleClearCache" > - <!-- <RotateCw class="mr-2 size-4" /> --> {{ $t('preferences.clearAndLogout') }} </VbenButton> </template>