更新记录

1.0.0(2021-01-20)

tabs 与swiper联动


平台兼容性

tab与swiper联动切换

引入

import hyxTabs from "@/components/hyx-tabs/hyx-tabs.vue";
    export default {
        components: {
            hyxTabs
        },
        data() {
            return {
                activeTab: 0,
                config:{
                    key: 'title',
                },
                dataList: [{
                    title: '全部',
                    list: [{
                        "name": "1"
                    }]
                },{
                    title: '热门推荐',
                    list: [{
                        "name": "2"
                    }]
                },{
                    title: '热门推荐',
                    list: [{
                        "name": "3"
                    }]
                },{
                    title: '热门推荐',
                    list: [{
                        "name": "4"
                    }]
                },{
                    title: '热门推荐',
                    list: [{
                        "name": "5"
                    }]
                },{
                    title: '热门推荐',
                    list: [{
                        "name": "6"
                    }]
                },{
                    title: '热门推荐',
                    list: [{
                        "name": "7"
                    }]
                },{
                    title: '热门推荐',
                    list: [{
                        "name": "8"
                    }]
                },{
                    title: '热门推荐',
                    list: [{
                        "name": "9"
                    }]
                },{
                    title: '热门推荐',
                    list: [{
                        "name": "10"
                    }]
                }]
            };
        },
        methods: {
            choseTab(index) {
                this.activeTab = index;
            },
            change(e){
                this.activeTab = e.detail.current;
                this.$refs.child.tabToIndex(this.activeTab)
            }
        }
    }

页面引用

<hyx-tabs ref="child" :tabData="dataList" :activeIndex="activeTab" @tabClick='choseTab' :config='config' />
<swiper class="swiper" :current="activeTab" @change="change">
    <swiper-item class="swiper-item" v-for="(item,index) in dataList" :key="index">
        <view class="li" v-for="(v,i) in item.list">
            {{v.name}}
        </view>
    </swiper-item>
</swiper>

隐私、权限声明

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

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

插件不采集任何数据

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

许可协议

MIT协议

暂无用户评论。

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