Skip to content

Drawer 抽屉

有些时候,对话框并不满足我们的需求,这时可以使用抽屉组件。

基础用法

vue
<template>
  <x-button @click="visible = true">打开抽屉</x-button>
  <x-drawer v-model="visible" title="我是标题">
    <p>我来啦!</p>
  </x-drawer>
</template>

<script setup>
import { ref } from 'vue'
const visible = ref(false)
</script>

不同方向

vue
<template>
  <x-button @click="visible = true">从左到右</x-button>
  <x-drawer v-model="visible" direction="ltr">从左到右</x-drawer>
</template>

API

Props

属性说明类型默认值
modelValue是否显示抽屉booleanfalse
title抽屉标题string
direction打开方向'ltr' | 'rtl' | 'ttb' | 'btt''rtl'
size抽屉大小string | number'30%'
withHeader是否显示标题booleantrue
showClose是否显示关闭按钮booleantrue
closeOnClickModal点击遮罩层关闭booleantrue
destroyOnClose关闭时销毁元素booleanfalse

Events

事件名说明
update:modelValue值改变时触发
open打开时触发
close关闭时触发

基于 MIT 许可发布