更新记录

1.0.1(2024-06-18)

修改实例代码

1.0.0(2024-06-18)

1.0.0


平台兼容性

Vue2 Vue3
×
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 4.0 app-vue × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × ×

使用说明


1.注册组件后直接使用,支持自定义列表内容。 2.该插件使用的预编译,需要自行安装scss/sass插件 3.如果发现组件有bug或者不完善可以留言交流。 4.该插件只支持vue2中使用,不支持在nvue中使用,hbuilderX 最好是更新到较新版本 5.使用时注意标签的个数和内容泪飙的个数保持一致

支持的平台


H5、app、微信小程序

使用方式
import zhCustomTabs from '@/components/zh-custom-tabs/zh-custom-tabs/zh-custom-tabs.vue';
在页面中使用组件
import zhCustomTabs from '@/components/zh-custom-tabs/zh-custom-tabs/zh-custom-tabs.vue';

<zhCustomTabs :tabs_list="list" :list="list" :current.sync="current" @click="clickTabs">
    <template #listItem="{ row,index }">
        <view class="goods">支持自定义内容{{ index }}</view>
    </template>
</zhCustomTabs>

参数说明


参数 类型 默认值 描述
is_nav Boolean false 是否自定义导航栏,用于计算滑动内容的高度
tabs_list Array [] tabs标签数据
keyName String name 从tabs_list元素对象中读取的键名
current Number 0 当前选中标签的索引
duration Number 300 滑块移动一次所需的时间,单位ms
bgColor String #fff 标签区域的背景颜色
lineWidth Number 40 选择中滑块的宽度(单位rpx)
lineHeight Number 6 选择中滑块的高度(单位rpx)
lineColor String #3c9cff 选择中滑块的颜色
inactiveStyle Object {} 菜单未选择中时的样式
activeStyle Object {rgb(48, 49, 51)} 菜单选择中时的样式
list Array [] 列表数据
list_h Number 滑动内容的高度(单位rpx )

Methods


事件

名称 说明 回调参数
click 点击标签或者滑倒对应的标签时触发 index: 标签索引值
示例
<template>
    <view class="">
        <zhCustomTabs :tabs_list="list" :list="list" :current.sync="current" @click="clickTabs">
            <template #listItem="{ row,index }">
                <view class="goods">支持自定义内容{{ index }}</view>
            </template>
        </zhCustomTabs>
    </view>
</template>

<script>
    import zhCustomTabs from '@/components/zh-custom-tabs/zh-custom-tabs/zh-custom-tabs.vue';
    export default {
        components: {
            zhCustomTabs
        },
        data() {
            return {
                list: [{
                        id: 1,
                        name: '苹果'
                    },
                    {
                        id: 2,
                        name: '香蕉'
                    },
                    {
                        id: 3,
                        name: '西瓜'
                    },
                    {
                        id: 4,
                        name: '菠萝'
                    },
                    {
                        id: 5,
                        name: '石榴'
                    },
                    {
                        id: 6,
                        name: '榴莲'
                    },
                    {
                        id: 7,
                        name: '香橙'
                    },
                    {
                        id: 8,
                        name: '黄桃'
                    }
                ],
                current: 0
            };
        },
        methods: {
            clickTabs(e) {
                console.log(e);
            }
        },
    };
</script>

<style lang="scss" scoped>
    .goods {
        height: 300rpx;
        background-color: rgba(60, 156, 255, 0.1);
        margin-bottom: 40rpx;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 30rpx;
    }
</style>

----- 别忘记点赞哟,您的肯定就是对我最大的支持 END ----- 如果任何疑问的可以在评论区留言,还可以加ZhangHaoqwezxc,我尽量解决。

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问