ant-design-vue/components/dropdown/demo/placement.vue

72 lines
1.6 KiB
Vue

<docs>
---
order: 1
title:
zh-CN: 弹出位置
en-US: Placement
---
## zh-CN
支持 6 个弹出位置
## en-US
Support 6 placements.
</docs>
<template>
<div id="components-dropdown-demo-placement">
<template v-for="(placement, index) in placements" :key="placement">
<a-dropdown :placement="placement">
<a-button>{{ placement }}</a-button>
<template #overlay>
<a-menu>
<a-menu-item>
<a target="_blank" rel="noopener noreferrer" href="http://www.alipay.com/">
1st menu item
</a>
</a-menu-item>
<a-menu-item>
<a target="_blank" rel="noopener noreferrer" href="http://www.taobao.com/">
2nd menu item
</a>
</a-menu-item>
<a-menu-item>
<a target="_blank" rel="noopener noreferrer" href="http://www.tmall.com/">
3rd menu item
</a>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
<br v-if="index === 2" />
</template>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import type { DropdownProps } from 'ant-design-vue';
export default defineComponent({
setup() {
return {
placements: [
'bottomLeft',
'bottom',
'bottomRight',
'topLeft',
'top',
'topRight',
] as DropdownProps['placement'][],
};
},
});
</script>
<style>
#components-dropdown-demo-placement .ant-btn {
margin-right: 8px;
margin-bottom: 8px;
}
</style>