# TabsRich 选项卡富文本 
支持滚动自动选中选项卡,支持点击锚点。
# 基础用法
<!-- @format -->
<template>
<qinui-theme :modelValue="theInited">
<qinui-tabs-rich :data="theRich" v-model="theNow" prefix="" />
</qinui-theme>
</template>
<script lang="ts" setup>
import { ref, shallowRef } from 'vue';
import { onLoad } from '@fe6/qinjs-app';
// 模拟数据 start
const theData = [
{
id: 6433,
sort: 3,
title: '项目介绍',
desc: '<p><strong>项目介绍项目</strong></p>\n',
},
{
id: 6507,
sort: 3,
title: '剧目介绍',
desc: '<p><strong>剧目介绍项目</strong></p>\n',
},
{
id: 6438,
sort: 3,
title: '一些介绍',
desc: '<p><strong>本项目</strong></p>\n',
},
];
// 模拟数据 end
const theInited = shallowRef(false);
const theNow = shallowRef('');
const theRich = ref<any>([]);
const onGetStoreInfo = () => {
// 加个延迟,模拟数据接口
setTimeout(() => {
theRich.value = theData.map(({ id, ...theOthers }: any) => ({
id: `test${id}`,
...theOthers,
}));
theNow.value = theRich.value[0].id;
theInited.value = true;
}, 400);
};
onLoad(onGetStoreInfo);
</script>
# API
# Props
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|---|---|---|---|---|
| prefix | id 前缀 | String | qtrb | - |
| modelValue (v-model) | 选中的值 | String | NUmber | 0 | - |
| lineColor | 滑块颜色 | String | - | - |
| scroll | 是否横向滚动 | Boolean | true | - |
| data | 数据,字段参考 | Array | - | - |
| fieldNames | 字段映射,参考 | Object | { label: 'title', value: 'id', desc: 'desc', } | - |
| autoLineWidth | 是否自动算滑块宽度 | Boolean | true | - |
| lineWidth | 滑块宽度 | String | 40rpx | - |
| lineHeight | 滑块高度 | String | - | - |
| lineBgSize | 滑块背景显示大小,当滑块背景设置为图片时使用 | String | cover | - |
| itemStyle | 菜单样式 | String | height:110rpx | - |
| diyStyle | 自定义外部样式,如:设置边框等样式 | String | - | - |
# Data Props
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|---|---|---|---|---|
| id | 唯一数据id | String | Number | - | - |
| label | 标题, tabs 中文 | String | - | - |
| desc | 富文本 | String | - | - |
# FieldNames Props
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|---|---|---|---|---|
| id | 选中的值 | String | id | - |
| label | 中文 | String | label | - |
| desc | 中文 | String | desc | - |