编写tabbar

<!-- 底部 -->
<template>
    <div class="footer">
        <div v-for="(item, index) in footerlist" :key="index" v-jump="item.to" class="footer_item" @click="dot(index)" :class="activeIndex==index?'active':''">
            <img :src="activeIndex==index?item.selectImg:item.img" alt="">
            <div class="footer_font">{{ item.text }}</div>
        </div>
    </div>
</template>

<script>
export default {
    data () {
        return {
            activeIndex:0,
            footerlist:[
                {
                    img:'/static/img1/img_03.jpg',
                    to:'/index',
                    text:'首页',
                    selectImg:'/static/img1/img_01_06.jpg'
                },
                 {
                    img:'/static/img1/img_01_08.jpg',
                    to:'/course',
                    text:'课程',
                    selectImg:'/static/img1/img_05.jpg'
                },
                 {
                    img:'/static/img1/img_01_10.jpg',
                    to:'/location',
                    text:'约课记录',
                    selectImg:'/static/img1/img2_03.png'
                },
                 {
                    img:'/static/img1/img_01_03.jpg',
                    to:'/index',
                    text:'练习',
                    selectImg:'/static/img1/img3_03.png'
                },
                 {
                    img:'/static/img1/img_01_13.jpg',
                    to:'/index',
                    text:'我的',
                    selectImg:'/static/img1/img3_03.png'
                }
            ]
        }
    },

    mounted(){
        
    },
    methods: {
        dot(index){
            this.activeIndex=index
        }
    },
    components: {
        
    },
}

</script>
<style scoped>
    .footer{
        width: 100%;
        height: 0.7rem;
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right:0
    }
    div>img{
        width: 0.4rem;
        height: 0.4rem;
    }
    .footer_item{
        width: 20%;
        text-align: center;
    }
.footer_font{
    font-size: 0.2rem;
    margin-top: 0.1rem;

}
.active{
    color:orange
}
</style>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值