Skip to content

引入组件 ​

局部引入

ts
// parent.vue
const FDrawer = defineAsyncComponent(() => import('@/components/formaui/f-drawer/f-drawer.vue'))

基础用法 ​

左右抽屉,内容超过一屏时建议使用 scroll-view。

html
<f-button width="200rpx" margin="24rpx auto" @click="showRightDrawer = true">从右边弹出</f-button>
<f-button width="200rpx" margin="24rpx auto" @click="showLeftDrawer = true">从左边弹出</f-button>

<f-drawer v-model="showLeftDrawer" mode="left">
  <view class="drawer-content">
    <f-button height="80rpx" type="success" shape="round" @click="showLeftDrawer = false">关闭抽屉</f-button>
  </view>
</f-drawer>

<f-drawer v-model="showRightDrawer" mode="right">
  <view class="drawer-content">
    <f-button height="80rpx" type="danger" shape="round" @click="showRightDrawer = false">关闭抽屉</f-button>
  </view>
</f-drawer>
ts
import { ref } from 'vue'

const showLeftDrawer = ref(false)
const showRightDrawer = ref(false)

插槽 ​

名称说明
default抽屉内容

属性 ​

名称类型说明默认值
v-modelboolean是否显示抽屉-
modestring弹出方向,可传入[left、right]right
isMaskboolean是否显示遮罩层true
closeOnClickMaskboolean是否点击遮罩层关闭true
zIndexnumber抽屉 z-index990
maskZIndexnumber遮罩层 z-index980
bgColorstring抽屉背景颜色#FFFFFF

事件 ​

事件名说明回调参数
---

方法 ​

方法名说明传入参数
---