Skip to content

引入组件

局部引入

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

基础用法

html
<f-button width="200rpx" margin="24rpx auto" @click="position = 'bottomRight'">右下角</f-button>
<f-button width="200rpx" margin="24rpx auto" @click="position = 'bottomLeft'">左下角</f-button>
<f-button width="200rpx" margin="24rpx auto" @click="position = 'topRight'">右上角</f-button>
<f-button width="200rpx" margin="24rpx auto" @click="position = 'topLeft'">左上角</f-button>
<f-button width="200rpx" margin="24rpx auto" @click="isCustomBtns = !isCustomBtns">自定义按钮列表</f-button>
<f-button width="200rpx" margin="24rpx auto" @click="btnDirection = btnDirection === 'column' ? 'row' : 'column'">{{ btnDirection === 'column' ? '纵向' : '横向' }}列表</f-button>
<f-fab :position="position" :btns="btns" :is-custom-btns="isCustomBtns" :btn-direction="btnDirection" @click="handleClick" @clickBtn="handleClickItem">
  <tui-icon color="white" name="plus"></tui-icon>
  <template #btns>
    <view class="p-[24rpx] bg-white rounded-md">自定义按钮1</view>
    <view class="p-[24rpx] bg-white rounded-md">自定义按钮2</view>
    <view class="p-[24rpx] bg-white rounded-md">自定义按钮3</view>
  </template>
</f-fab>
ts
import { ref } from 'vue'
const showPopup = ref<boolean>(false)

插槽

名称说明
default弹出层展示的内容
closeIcon弹出层关闭图标

属性

名称类型说明默认值
positionstring弹出层位置,可传入[bottomRightbottomLefttopRighttopLeft]bottomRight
isMaskboolean是否显示遮罩层true
widthstring自定义宽度108rpx
heightstring自定义高度108rpx
topstring自定义上偏移量auto
bottomstring自定义下偏移量54rpx
leftstring自定义左偏移量auto
rightstring自定义右偏移量54rpx
borderRadiusstring自定义圆角大小16rpx
bgColorstring自定义弹框背景颜色#FFFFFF
zIndexnumber自定义弹框 z-index12000
btnsboolean按钮列表:{width?: string;
height?: string;
borderRadius?: string;
bgColor?: string;
fontSize?: string
color?: string;
label: string;
value:string/number
disabled?: boolean}[]
[]
btnDirectionstring按钮列表方向column
btnGapstring按钮列表间距32rpx
isCustomBtnsboolean是否自定义按钮列表false

事件

事件名说明回调参数
click点击fab时触发-
btnClick点击按钮时触发btn值

方法

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