mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-06 14:53:50 +08:00
feat: 将 FaDropdown 组件插槽名从 label 修改为 header,并新增 footer 插槽
This commit is contained in:
@@ -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">
|
||||
当前登录账号
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user