fix: clearPreferencesAndLogout does not take effect when the preferences button is at the top (#4253)

This commit is contained in:
Li Kui
2024-08-28 09:58:59 +08:00
committed by GitHub
parent 6d24369272
commit c6b9a56b73
5 changed files with 21 additions and 7 deletions

View File

@@ -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]" />