You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/drawer/demo/render-in-current.vue

61 lines
1.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<docs>
---
order: 3
title:
zh-CN: 渲染在当前 DOM
en-US: Render in current dom
---
## zh-CN
渲染在当前 dom 自定义容器查看 `getContainer`
## en-US
Render in current dom. custom container, check `getContainer`.
</docs>
<template>
<div
:style="{
height: '200px',
overflow: 'hidden',
position: 'relative',
border: '1px solid #ebedf0',
borderRadius: '2px',
padding: '48px',
textAlign: 'center',
background: '#fafafa',
}"
>
Render in this
<div style="margin-top: 16px">
<a-button type="primary" @click="showDrawer">Open</a-button>
</div>
<a-drawer
title="Basic Drawer"
placement="right"
:closable="false"
:open="open"
:get-container="false"
:style="{ position: 'absolute' }"
@close="onClose"
>
<p>Some contents...</p>
</a-drawer>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
const open = ref(false);
const showDrawer = () => {
open.value = true;
};
const onClose = () => {
open.value = false;
};
</script>