20260817225227
This commit is contained in:
1 parent
d3acc7d28f
commit
b90ae89b0e
39 files changed
+3861
-353
No files matched your search
@@ -6,7 +6,7 @@
|
||||
* 从而复用现有的键盘导航 / 高亮 / 子菜单体系。
|
||||
*
|
||||
* 支持的属性与 items 数组项一一对应:
|
||||
* key 标识,点击时回传 @click 的 { key, item }
|
||||
* itemKey 标识,点击时回传 @click 的 { key, item }
|
||||
* icon 图标组件(Lucide)
|
||||
* label 菜单文本(也可直接用默认插槽写富内容,由父级读取 children)
|
||||
* danger 危险项(红色)
|
||||
@@ -15,7 +15,7 @@
|
||||
* onClick 项自带点击回调,命中时优先执行
|
||||
*/
|
||||
defineProps({
|
||||
key: { type: [String, Number], default: undefined },
|
||||
itemKey: { type: [String, Number], default: undefined },
|
||||
icon: { type: [Object, Function], default: undefined },
|
||||
label: { type: String, default: '' },
|
||||
danger: { type: Boolean, default: false },
|
||||
|
||||
@@ -50,7 +50,7 @@ function collectDropdownItems() {
|
||||
continue
|
||||
}
|
||||
const item = {}
|
||||
if (p.key != null) item.key = p.key
|
||||
if (p.itemKey != null) item.key = p.itemKey
|
||||
if (p.icon != null) item.icon = p.icon
|
||||
if (p.label != null) item.label = p.label
|
||||
if (p.danger) item.danger = true
|
||||
@@ -188,13 +188,7 @@ provide('dropdownActiveIndex', activeIndex)
|
||||
</template>
|
||||
|
||||
<template #content>
|
||||
<div
|
||||
ref="menuEl"
|
||||
class="dropdown-menu"
|
||||
role="menu"
|
||||
tabindex="-1"
|
||||
@keydown="onMenuKeydown"
|
||||
>
|
||||
<div ref="menuEl" class="dropdown-menu" role="menu" tabindex="-1" @keydown="onMenuKeydown">
|
||||
<!-- 富头部插槽:菜单项列表上方的自定义区域(头像+名字+组织等),有内容时才渲染 -->
|
||||
<div v-if="$slots.header" class="dropdown-header">
|
||||
<slot name="header" />
|
||||
|
||||
Reference in new issue
Block a user