首页 > 其他 > 详细

选项卡切换

时间:2020-05-16 12:56:02      阅读:38      评论:0      收藏:0      [点我收藏+]
<template>
    <view class="container">
        <view class="nav">
            <view class="navItem" :class="navIndex == index ? ‘navActive‘:‘‘" v-for="(item,index) in navList" :key="index" @tap="navClick(index)">{{item}}</view>
        </view>
        <view class="navCont" v-if="navIndex == 0">全部内容</view>
        <view class="navCont" v-if="navIndex == 1">卡一内容</view>
        <view class="navCont" v-if="navIndex == 2">卡二内容</view>
        <view class="navCont" v-if="navIndex == 3">卡三内容</view>
        <view class="navCont" v-if="navIndex == 4">卡四内容</view>
        <view class="navCont" v-if="navIndex == 5">卡五内容</view>
    </view>
</template>

<script>
    export default{
        data() {
            return {
                navList: [‘全部‘,‘卡一‘,‘卡二‘,‘卡三‘,‘卡四‘,‘卡五‘],
                navIndex: 0
            }
        },
        methods: {
            navClick(index) {
                this.navIndex = index;
            }
        },
    }
</script>

<style>
    page{
        background-color: #FAFAFA;
    }
    .nav{
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100upx;
        display: flex;
        justify-content: space-around;
        align-items: center;
        background-color: #FFFFFF;
    }
    .navItem{
        color: #333333;
        font-size: 32upx;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        line-height: 100upx;
    }
    .navActive{
        font-size: 42upx;
    }
    .navActive::after{
        content: ‘‘;
        width: 56upx;
        height: 8upx;
        background: #00ACFE;
        margin-top: -8upx;
    }
    .navCont{
        position: absolute;
        top: 130upx;
    }
</style>

 

选项卡切换

原文:https://www.cnblogs.com/songmengwen1124/p/12899018.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!