Dialog 弹窗

用法

基本用法

对话框组件
弹出一个对话框,提示用户确认信息
点击查看代码
<wd-button @click="centerDialogVisible = true">show dialog</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
    >Notice: before dialog gets opened for the first time this node and the
    one bellow will not be rendered</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
21

自定义底部

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

<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
    >Notice: before dialog gets opened for the first time this node and the
    one bellow will not be rendered</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

属性

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

事件

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