Skip to content

Commit 3c09401

Browse files
committed
FaDropdown 组件插槽名从 label 修改为 header,并新增 footer 插槽
1 parent 8796f3c commit 3c09401

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/components/AccountButton/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const isProfileShow = ref(false)
4141
],
4242
]" class="flex-center"
4343
>
44-
<template #label>
44+
<template #header>
4545
<div class="space-y-2">
4646
<div class="text-xs text-secondary-foreground/50 font-light">
4747
当前登录账号

src/ui/components/FaDropdown/index.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ const props = defineProps<{
3131
3232
const slots = defineSlots<{
3333
default?: () => VNode
34-
label?: () => VNode
34+
header?: () => VNode
35+
footer?: () => VNode
3536
}>()
3637
3738
const myItems = computed(() => {
@@ -55,9 +56,9 @@ function handleItemClick(item: { handle?: () => void }) {
5556
<slot />
5657
</DropdownMenuTrigger>
5758
<DropdownMenuContent :align :align-offset :side :side-offset :collision-padding>
58-
<template v-if="!!slots.label">
59+
<template v-if="!!slots.header">
5960
<DropdownMenuLabel>
60-
<slot name="label" />
61+
<slot name="header" />
6162
</DropdownMenuLabel>
6263
<DropdownMenuSeparator />
6364
</template>
@@ -72,6 +73,12 @@ function handleItemClick(item: { handle?: () => void }) {
7273
</DropdownMenuGroup>
7374
<DropdownMenuSeparator v-if="index !== myItems.length - 1" />
7475
</template>
76+
<template v-if="!!slots.footer">
77+
<DropdownMenuSeparator />
78+
<DropdownMenuLabel>
79+
<slot name="footer" />
80+
</DropdownMenuLabel>
81+
</template>
7582
</DropdownMenuContent>
7683
</DropdownMenu>
7784
</template>

0 commit comments

Comments
 (0)