| | |
| | | |
| | | const rightSlots = computed(() => { |
| | | const list: Array<SlotItem> = []; |
| | | if (preferences.widget.refresh) { |
| | | list.push({ index: REFERENCE_VALUE - 10, name: 'refresh' }); |
| | | } |
| | | // 全局搜索 |
| | | if (preferences.widget.globalSearch) { |
| | | list.push({ |
| | |
| | | |
| | | const leftSlots = computed(() => { |
| | | const list: Array<SlotItem> = []; |
| | | // 刷新 |
| | | if (preferences.widget.refresh) { |
| | | list.push({ |
| | | index: 0, |
| | | name: 'refresh', |
| | | }); |
| | | } |
| | | |
| | | Object.keys(slots).forEach((key) => { |
| | | // 适配插槽名称,例如第一个插槽名:header-left-1 |
| | | if (key.startsWith('header-left')) { |
| | |
| | | v-for="slot in leftSlots.filter((item) => item.index < REFERENCE_VALUE)" |
| | | :key="slot.name" |
| | | > |
| | | <slot :name="slot.name"> |
| | | <template v-if="slot.name === 'refresh'"> |
| | | <VbenIconButton class="my-0 mr-1 rounded-md" @click="refresh"> |
| | | <RotateCw class="size-4" /> |
| | | </VbenIconButton> |
| | | </template> |
| | | </slot> |
| | | <slot :name="slot.name"></slot> |
| | | </template> |
| | | <div class="flex-center hidden lg:block"> |
| | | <slot name="breadcrumb"></slot> |
| | | </div> |
| | | <div v-if="preferences.app.layout === 'mixed-nav'" class="portal-header-motto">开放协作 学术研究 服务发展</div> |
| | | <template |
| | | v-for="slot in leftSlots.filter((item) => item.index > REFERENCE_VALUE)" |
| | | :key="slot.name" |
| | |
| | | </template> |
| | | <div |
| | | :class="`menu-align-${preferences.header.menuAlign}`" |
| | | class="flex h-full min-w-0 flex-1 items-center" |
| | | class="portal-header-navigation flex h-full min-w-0 flex-1 items-center" |
| | | > |
| | | <slot name="menu"></slot> |
| | | </div> |
| | | <div class="flex h-full min-w-0 shrink-0 items-center"> |
| | | <div class="portal-header-tools flex h-full min-w-0 shrink-0 items-center"> |
| | | <template v-for="slot in rightSlots" :key="slot.name"> |
| | | <slot :name="slot.name"> |
| | | <template v-if="slot.name === 'global-search'"> |
| | | <template v-if="slot.name === 'refresh'"> |
| | | <VbenIconButton aria-label="刷新当前页面" title="刷新当前页面" class="my-0 mr-1 rounded-md" @click="refresh"> |
| | | <RotateCw class="size-4" /> |
| | | </VbenIconButton> |
| | | </template> |
| | | <template v-else-if="slot.name === 'global-search'"> |
| | | <div class="portal-header-search"> |
| | | <GlobalSearch |
| | | :presentation="preferences.app.layout === 'mixed-nav' ? 'portal' : 'compact'" |
| | | :enable-shortcut-key="globalSearchShortcutKey" |
| | | :menus="accessStore.accessMenus" |
| | | class="mr-1 sm:mr-4" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <template v-else-if="slot.name === 'database-backup'"> |