Drawer 抽屉

用法

基本用法

抽屉组件
有些时候, Dialog 组件并不满足我们的需求, 比如你的表单很长, 亦或是你需要临时展示一些文档, Drawer 拥有和 Dialog 几乎相同的 API, 在 UI 上带来不一样的体验
点击查看代码
<wd-button @click="centerDialogVisible = true">show drawer</wd-button>
<wd-dialog
  v-model="centerDialogVisible"
  title="Notice"
  width="40%"
  :show-close="true"
  @open="openHandler"
  @before-open="beforeOpen"
  @before-close="beforeClose"
  :append-to-body="false"
  :closeOnClickModal="false"
  :destroy-on-close="true"
>
  <span
    >drawer</span
  >
  <template #footer>
    <wd-button type="primary">确定</wd-button>
  </template>
</wd-dialog>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

自定义底部

可以通过slot的方式自定义底部按钮

<wd-drawer
  v-model="centerDialogVisible"
  title="Notice"
  width="40%"
  :show-close="true"
  @open="openHandler"
  @before-open="beforeOpen"
  @before-close="beforeClose"
  :append-to-body="false"
  :closeOnClickModal="false"
  :destroy-on-close="true"
>
  <span
    >drawer</span
  >
  <template #footer>
    <wd-button type="primary">确定</wd-button>
  </template>
</wd-drawer>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

属性

参数说明类型可选值默认值
appendToBody遮罩层是否插入至 body 元素上,若为 false,则遮罩层会插入至 Drawer 的父元素上booleantrue / falsefalse
customClass自定义类名string''''
closeOnClickModal点击遮罩是否关闭Drawerbooleantrue / falsetrue
destroyOnClose关闭Drawer时是否移除元素booleantrue / falsefalse
showClose是否显示关闭按钮booleantrue / falsetrue
titleDrawer标题string''''
openDelay延迟打开Drawernumber-0
closeDelay延迟关闭Drawernumber-0
top顶部marginstring-15vh
widthDrawer宽度string-50%

事件

事件名称说明回调参数
closeDrawer关闭时触发Function()
before-closeDrawer关闭之前触发Function()
openDrawer弹出时触发Function()
before-openDrawer弹出之前触发Function()