feat: 添加返回导航图标
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
fyy 2025-07-29 11:42:20 +08:00
parent fb537fdc00
commit ce445ae088
4 changed files with 29 additions and 1 deletions

View File

@ -267,6 +267,8 @@ interface WidgetPreferences {
sidebarToggle: boolean; sidebarToggle: boolean;
/** 是否显示主题切换部件 */ /** 是否显示主题切换部件 */
themeToggle: boolean; themeToggle: boolean;
/** 是否显示返回导航部件 */
backNavigation: boolean;
} }
interface Preferences { interface Preferences {

View File

@ -11,6 +11,7 @@ import {
LanguageToggle, LanguageToggle,
PreferencesButton, PreferencesButton,
ThemeToggle, ThemeToggle,
BackNavigation,
} from '../../widgets'; } from '../../widgets';
interface Props { interface Props {
@ -43,7 +44,8 @@ const rightSlots = computed(() => {
list.push({ list.push({
index: REFERENCE_VALUE, index: REFERENCE_VALUE,
name: 'global-search', name: 'global-search',
}); }
);
} }
if (preferencesButtonPosition.value.header) { if (preferencesButtonPosition.value.header) {
@ -76,6 +78,12 @@ const rightSlots = computed(() => {
name: 'notification', name: 'notification',
}); });
} }
if (preferences.widget.backNavigation) {
list.push({
index: REFERENCE_VALUE + 60,
name: 'back-navigation',
});
}
Object.keys(slots).forEach((key) => { Object.keys(slots).forEach((key) => {
const name = key.split('-'); const name = key.split('-');
@ -164,6 +172,9 @@ function clearPreferencesAndLogout() {
<template v-else-if="slot.name === 'fullscreen'"> <template v-else-if="slot.name === 'fullscreen'">
<VbenFullScreen class="mr-1" /> <VbenFullScreen class="mr-1" />
</template> </template>
<template v-else-if="slot.name === 'back-navigation'">
<BackNavigation class="mr-1" />
</template>
</slot> </slot>
</template> </template>
</div> </div>

View File

@ -0,0 +1,14 @@
<script setup lang="ts">
import { ArrowLeft } from '@vben/icons';
import { VbenIconButton } from '@vben-core/shadcn-ui';
import { useRouter } from 'vue-router';
const router = useRouter();
const back = () => {
router.push('/navigation');
}
</script>
<template>
<VbenIconButton @click="back">
<ArrowLeft></ArrowLeft>
</VbenIconButton>
</template>

View File

@ -9,3 +9,4 @@ export * from './notification';
export * from './preferences'; export * from './preferences';
export * from './theme-toggle'; export * from './theme-toggle';
export * from './user-dropdown'; export * from './user-dropdown';
export { default as BackNavigation } from './back-navigation.vue';