Skip to content

Drawer 抽屉

从屏幕边缘滑出的面板,用于显示侧边内容或表单。基于 BrConfigProvider 实现全局主题配置。

基础用法

Status: Closed

Example

方向

Example

尺寸

Example

关闭按钮

Example

API

Props

属性名类型默认值说明
openbooleanfalse是否打开
defaultOpenbooleanfalse默认是否打开
directionstring'bottom'方向:top, bottom, left, right
dismissiblebooleantrue是否可关闭
modalbooleantrue是否为模态

DrawerContent Props

属性名类型默认值说明
showHandlebooleanfalse是否显示把手
showClosebooleanfalse是否显示关闭按钮
classstring-自定义类名
shouldScaleBackgroundbooleanfalse是否锁定滚动
activeSnapPointstring | number-嵌套级别

Slots

插槽名说明
default触发器内容
content抽屉内容
header头部内容
footer底部内容

Emits

事件名说明参数
update:open打开状态变化时触发(value: boolean)
close关闭时触发-

使用示例

vue
<template>
  <BrDrawer v-model:open="isOpen">
    <BrDrawerTrigger>
      <BrButton>打开抽屉</BrButton>
    </BrDrawerTrigger>
    <BrDrawerContent>
      <BrDrawerHeader>
        <BrDrawerTitle>标题</BrDrawerTitle>
      </BrDrawerHeader>
      <div>内容...</div>
    </BrDrawerContent>
  </BrDrawer>
</template>

<script setup>
import { ref } from 'vue'
import { BrDrawer, BrDrawerTrigger, BrDrawerContent, BrDrawerHeader, BrDrawerTitle, BrButton } from '@breezeui/vue'

const isOpen = ref(false)
</script>