开始使用

Drawer 抽屉 ​

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

交互示例 ​

PREVIEW

使用代码 ​

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

<template>
  <WButton label="打开抽屉" @click="value = true" />
  <WDrawer v-model:visible="value" header="设置" position="right" :style="{ maxWidth: '100vw' }">
    <p>你的设置内容。</p>
  </WDrawer>
</template>

常用 Props / 配置 ​

名称说明类型默认值
visible可见性booleanfalse
positionleft / right / top / bottom / fullstringleft
header标题stringundefined

事件与方法 ​

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

插槽 ​

default、header、footer、container 等。

响应式与无障碍 ​

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

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

Wizdomt UI Vue 3 · PrimeVue 4