开始使用

Dialog 对话框 ​

本期保持 PrimeVue 4.5.5 原生 API。使用前按快速开始安装插件与 CSS。

交互示例 ​

PREVIEW

使用代码 ​

vue
<script setup lang="ts">
import { WButton } from '@wizdomt/ui'
import { ref } from 'vue'
import { WDialog } from '@wizdomt/ui'
const value = ref(false)
</script>

<template>
  <WButton label="打开对话框" @click="value = true" />
  <WDialog
    v-model:visible="value"
    modal
    header="标题"
    :style="{ width: '28rem', maxWidth: 'calc(100vw - 2rem)' }"
  >
    <p>保留原生焦点与 Escape 行为。</p>
    <template #footer><WButton label="完成" @click="value = false" /></template>
  </WDialog>
</template>

常用 Props / 配置 ​

名称说明类型默认值
visible可见性booleanfalse
header标题stringundefined
modal模态遮罩booleanfalse
breakpoints响应式宽度映射objectundefined

事件与方法 ​

update:visible、show、hide、after-hide。

插槽 ​

default、header、footer、container 等。

响应式与无障碍 ​

组件保持原生行为,不自动切换交互。为交互元素提供 label 或 aria-label;浮层按容器设置 max-width。响应式指南说明设备验证方法。

完整 Props、事件、Slots、Methods 以上游锁定版本类型声明为准。PrimeVue v4 dialog 文档可能包含较新 4.x API,使用时以本包 TypeScript 提示为准。

Wizdomt UI Vue 3 · PrimeVue 4