mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 01:11:25 +08:00
43 lines
1.0 KiB
Vue
43 lines
1.0 KiB
Vue
|
<template>
|
||
|
<el-dropdown @command="handleCommand">
|
||
|
<span class="el-dropdown-link">
|
||
|
Dropdown List<i class="el-icon-arrow-down el-icon--right"></i>
|
||
|
</span>
|
||
|
<template #dropdown>
|
||
|
<el-dropdown-menu>
|
||
|
<el-dropdown-item command="a">Action 1</el-dropdown-item>
|
||
|
<el-dropdown-item command="b">Action 2</el-dropdown-item>
|
||
|
<el-dropdown-item command="c">Action 3</el-dropdown-item>
|
||
|
<el-dropdown-item command="d" disabled>Action 4</el-dropdown-item>
|
||
|
<el-dropdown-item command="e" divided>Action 5</el-dropdown-item>
|
||
|
</el-dropdown-menu>
|
||
|
</template>
|
||
|
</el-dropdown>
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts">
|
||
|
import { defineComponent } from 'vue'
|
||
|
import { ElMessage } from 'element-plus'
|
||
|
|
||
|
export default defineComponent({
|
||
|
setup() {
|
||
|
const handleCommand = (command) => {
|
||
|
ElMessage(`click on item ${command}`)
|
||
|
}
|
||
|
return {
|
||
|
handleCommand,
|
||
|
}
|
||
|
},
|
||
|
})
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
.el-dropdown-link {
|
||
|
cursor: pointer;
|
||
|
color: #409eff;
|
||
|
}
|
||
|
.el-icon-arrow-down {
|
||
|
font-size: 12px;
|
||
|
}
|
||
|
</style>
|