feat: 将 FaDropdown 组件插槽名从 label 修改为 header,并新增 footer 插槽

This commit is contained in:
Hooray
2025-05-21 12:01:08 +08:00
parent 867852e501
commit b974139eeb
2 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ const isProfileShow = ref(false)
],
]" class="flex-center"
>
<template #label>
<template #header>
<div class="space-y-2">
<div class="text-xs text-secondary-foreground/50 font-light">
当前登录账号
+10 -3
View File
@@ -31,7 +31,8 @@ const props = defineProps<{
const slots = defineSlots<{
default?: () => VNode
label?: () => VNode
header?: () => VNode
footer?: () => VNode
}>()
const myItems = computed(() => {
@@ -55,9 +56,9 @@ function handleItemClick(item: { handle?: () => void }) {
<slot />
</DropdownMenuTrigger>
<DropdownMenuContent :align :align-offset :side :side-offset :collision-padding>
<template v-if="!!slots.label">
<template v-if="!!slots.header">
<DropdownMenuLabel>
<slot name="label" />
<slot name="header" />
</DropdownMenuLabel>
<DropdownMenuSeparator />
</template>
@@ -72,6 +73,12 @@ function handleItemClick(item: { handle?: () => void }) {
</DropdownMenuGroup>
<DropdownMenuSeparator v-if="index !== myItems.length - 1" />
</template>
<template v-if="!!slots.footer">
<DropdownMenuSeparator />
<DropdownMenuLabel>
<slot name="footer" />
</DropdownMenuLabel>
</template>
</DropdownMenuContent>
</DropdownMenu>
</template>