t-fab-item
FabItem 悬浮按钮项
组件介绍
悬浮按钮子组件,与t-fab组件配合使用,用于显示展开的子按钮,支持自定义内容和样式。
平台兼容
| Harmony | H5 | Android | iOS | 小程序 | 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
| 属性名 | 类型 | 默认值 | 说明 | 可选值 |
|---|---|---|---|---|
| size | String | "" | 组件尺寸 | large, medium, small, mini |
| type | String | "" | 组件类型 | info, primary, error, warning, success |
| disabled | Boolean | false | 组件是否禁用 | true, false |
| hover | Boolean | true | 是否有点击效果 | true, false |
| path | String | "" | 点击组件后跳转的页面路径 | - |
| effect | String | "" | 组件显示主题 | normal, dark, light, plain |
Events
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| click | 点击时触发 | - |
| touchstart | 触摸开始时触发 | 触摸事件对象 |
| touchend | 触摸结束时触发 | 触摸事件对象 |
| touchmove | 触摸移动时触发 | 触摸事件对象 |
| touchcancel | 触摸取消时触发 | 触摸事件对象 |
Slots
| 插槽名 | 说明 |
|---|---|
| default | 按钮内容插槽,用于自定义按钮的内容 |