2020-08-13 15:18:26 +08:00
|
|
|
|
## Dropdown 下拉菜单
|
|
|
|
|
|
|
|
|
|
将动作或菜单折叠到下拉菜单中。
|
|
|
|
|
|
|
|
|
|
### 基础用法
|
|
|
|
|
|
|
|
|
|
移动到下拉菜单上,展开更多操作。
|
|
|
|
|
|
|
|
|
|
:::demo 通过组件`slot`来设置下拉触发的元素以及需要通过具名`slot`为`dropdown` 来设置下拉菜单。默认情况下,下拉按钮只要`hover`即可,无需点击也会显示下拉菜单。
|
|
|
|
|
|
|
|
|
|
```html
|
|
|
|
|
<el-dropdown>
|
|
|
|
|
<span class="el-dropdown-link">
|
|
|
|
|
下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
|
|
</span>
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
|
|
|
|
<el-dropdown-item>黄金糕</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>狮子头</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>螺蛳粉</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item disabled>双皮奶</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item divided>蚵仔煎</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.el-dropdown-link {
|
|
|
|
|
cursor: pointer;
|
2021-09-04 19:29:28 +08:00
|
|
|
|
color: #409eff;
|
2020-08-13 15:18:26 +08:00
|
|
|
|
}
|
|
|
|
|
.el-icon-arrow-down {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
```
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
|
:::
|
|
|
|
|
|
|
|
|
|
### 触发对象
|
|
|
|
|
|
|
|
|
|
可使用按钮触发下拉菜单。
|
|
|
|
|
|
|
|
|
|
:::demo 设置`split-button`属性来让触发下拉元素呈现为按钮组,左边是功能按钮,右边是触发下拉菜单的按钮,设置为`true`即可。
|
|
|
|
|
|
|
|
|
|
```html
|
|
|
|
|
<el-dropdown>
|
|
|
|
|
<el-button type="primary">
|
|
|
|
|
更多菜单<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
|
|
</el-button>
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
|
|
|
|
<el-dropdown-item>黄金糕</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>狮子头</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>螺蛳粉</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>双皮奶</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>蚵仔煎</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
</el-dropdown>
|
|
|
|
|
<el-dropdown split-button type="primary" @click="handleClick">
|
|
|
|
|
更多菜单
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
|
|
|
|
<el-dropdown-item>黄金糕</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>狮子头</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>螺蛳粉</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>双皮奶</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>蚵仔煎</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.el-dropdown {
|
|
|
|
|
vertical-align: top;
|
|
|
|
|
}
|
|
|
|
|
.el-dropdown + .el-dropdown {
|
|
|
|
|
margin-left: 15px;
|
|
|
|
|
}
|
|
|
|
|
.el-icon-arrow-down {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
methods: {
|
|
|
|
|
handleClick() {
|
2021-09-04 19:29:28 +08:00
|
|
|
|
alert('button click')
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-08-13 15:18:26 +08:00
|
|
|
|
}
|
|
|
|
|
</script>
|
2021-06-10 00:23:34 +08:00
|
|
|
|
<!--
|
|
|
|
|
<setup>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
|
2021-06-10 00:23:34 +08:00
|
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
setup() {
|
|
|
|
|
const handleClick = () => {
|
|
|
|
|
alert('button click');
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
handleClick,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
</setup>
|
|
|
|
|
-->
|
2020-08-13 15:18:26 +08:00
|
|
|
|
```
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
|
:::
|
|
|
|
|
|
|
|
|
|
### 触发方式
|
|
|
|
|
|
|
|
|
|
可以配置 click 激活或者 hover 激活。
|
|
|
|
|
|
|
|
|
|
:::demo 在`trigger`属性设置为`click`即可。
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
|
```html
|
|
|
|
|
<el-row class="block-col-2">
|
2021-01-25 11:21:31 +08:00
|
|
|
|
<el-col :span="8">
|
2020-08-13 15:18:26 +08:00
|
|
|
|
<span class="demonstration">hover 激活</span>
|
|
|
|
|
<el-dropdown>
|
|
|
|
|
<span class="el-dropdown-link">
|
|
|
|
|
下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
|
|
</span>
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
|
|
|
|
<el-dropdown-item icon="el-icon-plus">黄金糕</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item icon="el-icon-circle-plus">狮子头</el-dropdown-item>
|
2021-09-04 19:29:28 +08:00
|
|
|
|
<el-dropdown-item icon="el-icon-circle-plus-outline"
|
|
|
|
|
>螺蛳粉</el-dropdown-item
|
|
|
|
|
>
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<el-dropdown-item icon="el-icon-check">双皮奶</el-dropdown-item>
|
2021-09-04 19:29:28 +08:00
|
|
|
|
<el-dropdown-item icon="el-icon-circle-check"
|
|
|
|
|
>蚵仔煎</el-dropdown-item
|
|
|
|
|
>
|
2020-10-28 15:16:06 +08:00
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
</el-dropdown>
|
|
|
|
|
</el-col>
|
2021-01-25 11:21:31 +08:00
|
|
|
|
<el-col :span="8">
|
2020-08-13 15:18:26 +08:00
|
|
|
|
<span class="demonstration">click 激活</span>
|
|
|
|
|
<el-dropdown trigger="click">
|
|
|
|
|
<span class="el-dropdown-link">
|
|
|
|
|
下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
|
|
</span>
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
|
|
|
|
<el-dropdown-item icon="el-icon-plus">黄金糕</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item icon="el-icon-circle-plus">狮子头</el-dropdown-item>
|
2021-09-04 19:29:28 +08:00
|
|
|
|
<el-dropdown-item icon="el-icon-circle-plus-outline"
|
|
|
|
|
>螺蛳粉</el-dropdown-item
|
|
|
|
|
>
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<el-dropdown-item icon="el-icon-check">双皮奶</el-dropdown-item>
|
2021-09-04 19:29:28 +08:00
|
|
|
|
<el-dropdown-item icon="el-icon-circle-check"
|
|
|
|
|
>蚵仔煎</el-dropdown-item
|
|
|
|
|
>
|
2020-10-28 15:16:06 +08:00
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
</el-dropdown>
|
|
|
|
|
</el-col>
|
2021-01-25 11:21:31 +08:00
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<span class="demonstration">右键(contextmenu) 激活</span>
|
|
|
|
|
<el-dropdown trigger="contextmenu">
|
|
|
|
|
<span class="el-dropdown-link">
|
|
|
|
|
下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
|
|
</span>
|
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
|
|
|
|
<el-dropdown-item icon="el-icon-plus">黄金糕</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item icon="el-icon-circle-plus">狮子头</el-dropdown-item>
|
2021-09-04 19:29:28 +08:00
|
|
|
|
<el-dropdown-item icon="el-icon-circle-plus-outline"
|
|
|
|
|
>螺蛳粉</el-dropdown-item
|
|
|
|
|
>
|
2021-01-25 11:21:31 +08:00
|
|
|
|
<el-dropdown-item icon="el-icon-check">双皮奶</el-dropdown-item>
|
2021-09-04 19:29:28 +08:00
|
|
|
|
<el-dropdown-item icon="el-icon-circle-check"
|
|
|
|
|
>蚵仔煎</el-dropdown-item
|
|
|
|
|
>
|
2021-01-25 11:21:31 +08:00
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
</el-col>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.el-dropdown-link {
|
|
|
|
|
cursor: pointer;
|
2021-09-04 19:29:28 +08:00
|
|
|
|
color: #409eff;
|
2020-08-13 15:18:26 +08:00
|
|
|
|
}
|
|
|
|
|
.el-icon-arrow-down {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
.demonstration {
|
|
|
|
|
display: block;
|
2021-08-26 09:57:56 +08:00
|
|
|
|
color: var(--el-text-color-secondary);
|
2020-08-13 15:18:26 +08:00
|
|
|
|
font-size: 14px;
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
```
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
|
:::
|
|
|
|
|
|
|
|
|
|
### 菜单隐藏方式
|
|
|
|
|
|
|
|
|
|
可以`hide-on-click`属性来配置。
|
|
|
|
|
|
|
|
|
|
:::demo 下拉菜单默认在点击菜单项后会被隐藏,将`hide-on-click`属性默认为`false`可以关闭此功能。
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
|
```html
|
|
|
|
|
<el-dropdown :hide-on-click="false">
|
|
|
|
|
<span class="el-dropdown-link">
|
|
|
|
|
下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
|
|
</span>
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
|
|
|
|
<el-dropdown-item>黄金糕</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>狮子头</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>螺蛳粉</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item disabled>双皮奶</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item divided>蚵仔煎</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.el-dropdown-link {
|
|
|
|
|
cursor: pointer;
|
2021-09-04 19:29:28 +08:00
|
|
|
|
color: #409eff;
|
2020-08-13 15:18:26 +08:00
|
|
|
|
}
|
|
|
|
|
.el-icon-arrow-down {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
```
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
|
:::
|
|
|
|
|
|
|
|
|
|
### 指令事件
|
|
|
|
|
|
|
|
|
|
点击菜单项后会触发事件,用户可以通过相应的菜单项 key 进行不同的操作
|
|
|
|
|
|
|
|
|
|
:::demo
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
|
```html
|
|
|
|
|
<el-dropdown @command="handleCommand">
|
|
|
|
|
<span class="el-dropdown-link">
|
|
|
|
|
下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
|
|
</span>
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
|
|
|
|
<el-dropdown-item command="a">黄金糕</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item command="b">狮子头</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item command="c">螺蛳粉</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item command="d" disabled>双皮奶</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item command="e" divided>蚵仔煎</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.el-dropdown-link {
|
|
|
|
|
cursor: pointer;
|
2021-09-04 19:29:28 +08:00
|
|
|
|
color: #409eff;
|
2020-08-13 15:18:26 +08:00
|
|
|
|
}
|
|
|
|
|
.el-icon-arrow-down {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
methods: {
|
|
|
|
|
handleCommand(command) {
|
2021-09-04 19:29:28 +08:00
|
|
|
|
this.$message('click on item ' + command)
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-08-13 15:18:26 +08:00
|
|
|
|
}
|
|
|
|
|
</script>
|
2021-06-10 00:23:34 +08:00
|
|
|
|
<!--
|
|
|
|
|
<setup>
|
|
|
|
|
|
|
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
setup() {
|
2021-06-18 17:32:05 +08:00
|
|
|
|
|
2021-06-10 00:23:34 +08:00
|
|
|
|
const handleCommand = (command) => {
|
|
|
|
|
ElMessage(`click on item ${command}`);
|
|
|
|
|
};
|
|
|
|
|
return {
|
|
|
|
|
handleCommand,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
</setup>
|
|
|
|
|
-->
|
2020-08-13 15:18:26 +08:00
|
|
|
|
```
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
|
:::
|
|
|
|
|
|
|
|
|
|
### 不同尺寸
|
|
|
|
|
|
|
|
|
|
Dropdown 组件提供除了默认值以外的三种尺寸,可以在不同场景下选择合适的尺寸。
|
|
|
|
|
|
|
|
|
|
:::demo 额外的尺寸:`medium`、`small`、`mini`,通过设置`size`属性来配置它们。
|
|
|
|
|
|
|
|
|
|
```html
|
|
|
|
|
<el-dropdown split-button type="primary">
|
|
|
|
|
默认尺寸
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
|
|
|
|
<el-dropdown-item>黄金糕</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>狮子头</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>螺蛳粉</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>双皮奶</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>蚵仔煎</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
|
|
|
|
<el-dropdown size="medium" split-button type="primary">
|
|
|
|
|
中等尺寸
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
|
|
|
|
<el-dropdown-item>黄金糕</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>狮子头</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>螺蛳粉</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>双皮奶</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>蚵仔煎</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
|
|
|
|
<el-dropdown size="small" split-button type="primary">
|
|
|
|
|
小型尺寸
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
|
|
|
|
<el-dropdown-item>黄金糕</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>狮子头</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>螺蛳粉</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>双皮奶</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>蚵仔煎</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
|
|
|
|
<el-dropdown size="mini" split-button type="primary">
|
|
|
|
|
超小尺寸
|
2020-10-28 15:16:06 +08:00
|
|
|
|
<template #dropdown>
|
|
|
|
|
<el-dropdown-menu>
|
|
|
|
|
<el-dropdown-item>黄金糕</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>狮子头</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>螺蛳粉</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>双皮奶</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item>蚵仔煎</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
2020-08-13 15:18:26 +08:00
|
|
|
|
</el-dropdown>
|
|
|
|
|
```
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
2020-08-13 15:18:26 +08:00
|
|
|
|
:::
|
|
|
|
|
|
|
|
|
|
### Dropdown Attributes
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
|
|
|
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
|
|
|
| ------------- | -------------------------------------------------------------------------------------------------------- | --------------- | ---------------------------------------------------- | ------ |
|
|
|
|
|
| type | 菜单按钮类型,同 Button 组件(只在`split-button`为 true 的情况下有效) | string | — | — |
|
|
|
|
|
| size | 菜单尺寸,在`split-button`为 true 的情况下也对触发按钮生效 | string | medium / small / mini | — |
|
|
|
|
|
| max-height | 菜单最大高度 | string / number | — | — |
|
|
|
|
|
| split-button | 下拉触发元素呈现为按钮组 | boolean | — | false |
|
|
|
|
|
| disabled | 是否禁用 | boolean | — | false |
|
|
|
|
|
| placement | 菜单弹出位置 | string | top/top-start/top-end/bottom/bottom-start/bottom-end | bottom |
|
|
|
|
|
| trigger | 触发下拉的行为 | string | hover, click, contextmenu | hover |
|
|
|
|
|
| hide-on-click | 是否在点击菜单项后隐藏菜单 | boolean | — | true |
|
|
|
|
|
| show-timeout | 展开下拉菜单的延时(仅在 trigger 为 hover 时有效) | number | — | 250 |
|
|
|
|
|
| hide-timeout | 收起下拉菜单的延时(仅在 trigger 为 hover 时有效) | number | — | 150 |
|
|
|
|
|
| tabindex | Dropdown 组件的 [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | number | — | 0 |
|
2020-08-13 15:18:26 +08:00
|
|
|
|
|
|
|
|
|
### Dropdown Slots
|
|
|
|
|
|
2021-09-04 19:29:28 +08:00
|
|
|
|
| Name | 说明 |
|
|
|
|
|
| -------- | ---------------------------------------------------------- |
|
|
|
|
|
| — | 触发下拉列表显示的元素。 注意: 必须是一个元素或者或者组件 |
|
|
|
|
|
| dropdown | 下拉列表,通常是 `<el-dropdown-menu>` 组件 |
|
2020-08-13 15:18:26 +08:00
|
|
|
|
|
|
|
|
|
### Dropdown Events
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
|
|
|
|
| 事件名称 | 说明 | 回调参数 |
|
|
|
|
|
| -------------- | --------------------------------------------- | ----------------------------- |
|
|
|
|
|
| click | `split-button` 为 true 时,点击左侧按钮的回调 | — |
|
|
|
|
|
| command | 点击菜单项触发的事件回调 | dropdown-item 的指令 |
|
|
|
|
|
| visible-change | 下拉框出现/隐藏时触发 | 出现则为 true,隐藏则为 false |
|
2020-08-13 15:18:26 +08:00
|
|
|
|
|
|
|
|
|
### Dropdown Menu Item Attributes
|
2021-09-04 19:29:28 +08:00
|
|
|
|
|
|
|
|
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
|
|
|
| -------- | ---------- | -------------------- | ------ | ------ |
|
|
|
|
|
| command | 指令 | string/number/object | — | — |
|
|
|
|
|
| disabled | 禁用 | boolean | — | false |
|
|
|
|
|
| divided | 显示分割线 | boolean | — | false |
|
|
|
|
|
| icon | 图标类名 | string | — | — |
|