mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-14 10:00:58 +08:00

* perf: change to import-x * feat: add rules * chore: fix rule * chore: fix * chore: fix * chore: fix * style: `pnpm lint:fix` * Revert "style: `pnpm lint:fix`" This reverts commit db0116a288299c507e3cfc4d7a22e2207265d920. * Revert "chore: fix" This reverts commit 69c82a90c01525e38180be4c21e8ef5602512318. * chore: fix * style: `pnpm lint:fix` * fix: lint * chore: `pnpm format`
63 lines
1.8 KiB
Vue
63 lines
1.8 KiB
Vue
<template>
|
|
<div style="font-size: 14px">
|
|
<p>open(close) the Dropdown list2 will close(open) the Dropdown List1.</p>
|
|
</div>
|
|
<div style="margin: 15px">
|
|
<el-button @click="showClick">show</el-button>
|
|
</div>
|
|
<el-dropdown ref="dropdown1" trigger="contextmenu" style="margin-right: 30px">
|
|
<span class="el-dropdown-link"> Dropdown List1 </span>
|
|
<template #dropdown>
|
|
<el-dropdown-menu>
|
|
<el-dropdown-item>Action 1</el-dropdown-item>
|
|
<el-dropdown-item>Action 2</el-dropdown-item>
|
|
<el-dropdown-item>Action 3</el-dropdown-item>
|
|
<el-dropdown-item disabled>Action 4</el-dropdown-item>
|
|
<el-dropdown-item divided>Action 5</el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</template>
|
|
</el-dropdown>
|
|
|
|
<el-dropdown trigger="contextmenu" @visible-change="handleVisible2">
|
|
<span class="el-dropdown-link"> Dropdown List2 </span>
|
|
<template #dropdown>
|
|
<el-dropdown-menu>
|
|
<el-dropdown-item>Action 1</el-dropdown-item>
|
|
<el-dropdown-item>Action 2</el-dropdown-item>
|
|
<el-dropdown-item>Action 3</el-dropdown-item>
|
|
<el-dropdown-item disabled>Action 4</el-dropdown-item>
|
|
<el-dropdown-item divided>Action 5</el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</template>
|
|
</el-dropdown>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref } from 'vue'
|
|
|
|
import type { DropdownInstance } from 'element-plus'
|
|
|
|
const dropdown1 = ref<DropdownInstance>()
|
|
function handleVisible2(visible: any) {
|
|
if (!dropdown1.value) return
|
|
if (visible) {
|
|
dropdown1.value.handleClose()
|
|
} else {
|
|
dropdown1.value.handleOpen()
|
|
}
|
|
}
|
|
function showClick() {
|
|
if (!dropdown1.value) return
|
|
dropdown1.value.handleOpen()
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.example-showcase .el-dropdown-link {
|
|
cursor: pointer;
|
|
color: var(--el-color-primary);
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
</style>
|