Skip to content

t-fab-item

FabItem 悬浮按钮项

组件介绍

悬浮按钮子组件,与t-fab组件配合使用,用于显示展开的子按钮,支持自定义内容和样式。

平台兼容

HarmonyH5AndroidiOS小程序UTS

基础用法

vue
<template>
  <t-fab direction="column-bottom" spacing="20rpx">
    <t-fab-item type="primary" @click="handleAdd">
      <t-icon name="plus" size="large" color="#fff"></t-icon>
    </t-fab-item>
    <t-fab-item type="success" @click="handleShare">
      <t-icon name="share" size="large" color="#fff"></t-icon>
    </t-fab-item>
    <t-fab-item type="warning" @click="handleEdit">
      <t-icon name="edit" size="large" color="#fff"></t-icon>
    </t-fab-item>
    <t-fab-item type="error" @click="handleDelete">
      <t-icon name="delete" size="large" color="#fff"></t-icon>
    </t-fab-item>
  </t-fab>
</template>

<script setup>
function handleAdd() {
  console.log('添加');
}

function handleShare() {
  console.log('分享');
}

function handleEdit() {
  console.log('编辑');
}

function handleDelete() {
  console.log('删除');
}
</script>

Props

属性名类型默认值说明可选值
sizeString""组件尺寸large, medium, small, mini
typeString""组件类型info, primary, error, warning, success
disabledBooleanfalse组件是否禁用true, false
hoverBooleantrue是否有点击效果true, false
pathString""点击组件后跳转的页面路径-
effectString""组件显示主题normal, dark, light, plain

Events

事件名说明回调参数
click点击时触发-
touchstart触摸开始时触发触摸事件对象
touchend触摸结束时触发触摸事件对象
touchmove触摸移动时触发触摸事件对象
touchcancel触摸取消时触发触摸事件对象

Slots

插槽名说明
default按钮内容插槽,用于自定义按钮的内容