更新记录
1.0.0.1(2025-12-30)
下载此版本
master
1.0.0.2(2025-12-30)
下载此版本
master
平台兼容性
uni-app(4.13)
| Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
| √ |
√ |
√ |
√ |
√ |
- |
√ |
√ |
√ |
| 微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
| √ |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
其他
安装
在市场导入xf-tabuni_modules版本的即可,无需import
组件关联说明
代码演示
基本用法
<template>
<view>
<xf-tab :tabs="tabs10" customClass="b-mt16" v-model="current10" :scroll="false"></xf-tab>
<xf-tab :tabs="tabs11" customClass="b-mt16" v-model="current11" :scroll="true" @change="changeTab"></xf-tab>
<xf-tab :tabs="tabs20" customClass="b-mt16" v-model="current20" gridType="second" :scroll="false"
@change="changeTab"></xf-tab>
<xf-tab :tabs="tabs21" customClass="b-mt16" v-model="current21" gridType="second" :scroll="true"
@change="changeTab"></xf-tab>
<xf-tab :tabs="tabs30" customClass="b-mt16" v-model="current30" gridType="third" :scroll="false"
@change="changeTab"></xf-tab>
<xf-tab :tabs="tabs31" customClass="b-mt16" v-model="current31" gridType="third" :scroll="true"
@change="changeTab"></xf-tab>
</view>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
const tabs10 = [{
name: '一级标题选择',
}, {
name: '一级标题选择',
}, {
name: '一级标题选择',
}]
const current10 = ref(0)
const tabs11 = [{
name: '一级标题选择标题选择',
}, {
name: '一级标题选择标题选择标题选择',
}, {
name: '一级标题',
}, {
name: '一级标',
}, {
name: '一级标题选择题选择标题选择标题选择',
},]
const current11 = ref(2)
const tabs20 = [{
name: '二级标题选择',
}, {
name: '二级标题选择',
}, {
name: '二级标题选择',
}]
const current20 = ref(0)
const tabs21 = [{
name: '二级标题选择',
}, {
name: '二级标题选择',
}, {
name: '二级标题选择',
}, {
name: '二级标题选择',
}, {
name: '二级标题选择',
},]
const current21 = ref(0)
const tabs30 = [{
name: '三级标题选择',
}, {
name: '三级标题选择',
}, {
name: '三级标题选择',
}]
const current30 = ref(0)
const tabs31 = [{
name: '三级标题选择',
}, {
name: '三级标题选择',
}, {
name: '三级标题选择',
}, {
name: '三级标题选择',
}, {
name: '三级标题选择',
}, {
name: '三级选择',
},]
const current31 = ref(0)
const changeTab = (e) => {
}
</script>
<template>
<view>
<xf-tab :tabs="tabs10" customClass="b-mt16" v-model="current10" :scroll="false"
baseColor="#FFF000" activeColor="#FF0000" :fontSize="18"></xf-tab>
<xf-tab :tabs="tabs20" customClass="b-mt16" v-model="current20" gridType="second" :scroll="false"
@change="changeTab" baseColor="#FFF000" activeColor="#FF0000" :fontSize="16"></xf-tab>
<xf-tab :tabs="tabs30" customClass="b-mt16" v-model="current30" gridType="third" :scroll="false"
@change="changeTab" baseColor="#FFF000" activeColor="#FF0000" :fontSize="14"></xf-tab>
</view>
</template>
API
Props
| 属性名 |
说明 |
类型 |
默认值 |
| v-model:modelValue |
绑定当前选中标签的标识符(index) |
number |
0 |
| tabs |
标签页标题列表,对象列表时,标题key必须与field对应 |
array<any> |
- |
| field |
tabs标题对应的key |
string |
name |
| customClass |
自定义class |
string |
- |
| gridType |
标签页标题类型可选first|second|third |
string |
first |
| bgColor |
背景颜色 |
string |
#FFF |
| activeColor |
字体选中颜色 |
string |
- |
| fontSize |
字体大小 |
number |
true |
| scroll |
标签页是否可以滚动 |
boolean |
2 |
| height |
标签页高度 |
string |
44px |
| lineHeight |
底部条高度 |
string |
3px |
| lineAnimation |
是否展示底部滚动动画 |
boolean |
true |
| showMore |
是否可选标题(条件:gridType=third) |
boolean |
true |
事件 Emits
| 事件名 |
说明 |
返回值 |
| change |
当前激活的标签改变时触发 |
|