Browse Source
fix: clearPreferencesAndLogout does not take effect when the preferences button is at the top (#4253)
pull/4258/head
Li Kui
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with
21 additions and
7 deletions
-
packages/@core/ui-kit/layout-ui/src/vben-layout.vue
-
packages/effects/layouts/src/basic/header/header.vue
-
packages/effects/layouts/src/basic/layout.vue
-
packages/effects/layouts/src/widgets/preferences/preferences-button.vue
-
packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue
|
|
|
@ -184,9 +184,6 @@ const headerFixed = computed(() => { |
|
|
|
}); |
|
|
|
|
|
|
|
const showSidebar = computed(() => { |
|
|
|
// if (isMixedNav.value && !props.sideHidden) { |
|
|
|
// return false; |
|
|
|
// } |
|
|
|
return isSideMode.value && sidebarEnable.value; |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
@ -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]" /> |
|
|
|
|
|
|
|
@ -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 |
|
|
|
|
|
|
|
@ -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> |
|
|
|
|
|
|
|
@ -413,7 +413,6 @@ async function handleReset() { |
|
|
|
variant="ghost" |
|
|
|
@click="handleClearCache" |
|
|
|
> |
|
|
|
<!-- <RotateCw class="mr-2 size-4" /> --> |
|
|
|
{{ $t('preferences.clearAndLogout') }} |
|
|
|
</VbenButton> |
|
|
|
</template> |
|
|
|
|