ant-design-vue/components/date-picker/demo/placement.vue
2022-05-15 14:48:46 +08:00

47 lines
1.1 KiB
Vue

<docs>
---
order: 28
title:
zh-CN: 弹出位置
en-US: Popup Placement
---
## zh-CN
可以通过 `placement` 手动指定弹出的位置
## en-US
You can manually specify the position of the popup via `placement`.
</docs>
<template>
<a-radio-group v-model:value="placement">
<a-radio-button value="topLeft">topLeft</a-radio-button>
<a-radio-button value="topRight">topRight</a-radio-button>
<a-radio-button value="bottomLeft">bottomLeft</a-radio-button>
<a-radio-button value="bottomRight">bottomRight</a-radio-button>
</a-radio-group>
<br />
<br />
<a-space direction="vertical" :size="12">
<a-date-picker v-model:value="value1" :placement="placement" />
<a-range-picker v-model:value="value2" :placement="placement" />
</a-space>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
import type { Dayjs } from 'dayjs';
export default defineComponent({
setup() {
const placement = ref('topLeft' as const);
return {
placement,
value1: ref<Dayjs>(),
value2: ref<[Dayjs, Dayjs]>(),
};
},
});
</script>