mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-07 16:28:49 +08:00
feat: 将 FaDropdown 组件插槽名从 label 修改为 header,并新增 footer 插槽
This commit is contained in:
@@ -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