vue移动端底部导航栏组件

需要更换图片样式自行更改
投的页面不需要底部导航栏在 在路由原信息里面设置true或false 在使用组件是进行显示和隐藏

<template>
    <div class="footbar-main">
        <ul class="bootbar">
            <router-link class="bootbar-item" :to="{name: 'home'}" tag="li">
                <span class="footbar-img home"></span>
                <span class="footbar-text">首页</span>
            </router-link>
            <router-link class="bootbar-item" :to="{name: 'kind'}" tag="li">
                <span class="footbar-img kind"></span>
                <span class="footbar-text">分类</span>
            </router-link>
            <router-link class="bootbar-item" :to="{name: 'find'}" tag="li">
                <span class="footbar-img find"></span>
                <span class="footbar-text">发现</span>
            </router-link>
            <router-link class="bootbar-item" :to="{name: 'mine'}" tag="li">
                <span class="footbar-img mine"></span>
                <span class="footbar-text">我的</span>
            </router-link>
        </ul>
    </div>
</template>

<script>
export default {
    name: 'Footbar',
    data() {
        return {

        }
    }
}
</script>
<style lang="scss" scoped>
.footbar-main {
    position: fixed;
    left: 0;
    bottom: 0;
    height: 80px;
    width: 100%;
    background-color: #fff;
    z-index: 999;
    .bootbar {
        display: flex;
        height: 100%;
        width: 100%;
        padding: 15px;
        box-sizing: border-box;
        .bootbar-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 25%;
            height: 100%;
            .footbar-img {
                // 背景图片公共
                height: 40px;
                width: 40px;
                background-size: 80%;
                background-position: center;
                background-repeat: no-repeat;
                //当前展示图片
                &.home {
                    background-image: url("../../assets/imgs/icons/home.png");
                }

                &.kind {
                    background-image: url("../../assets/imgs/icons/kind.png");
                }

                &.find {
                    background-image: url("../../assets/imgs/icons/find.png");
                }

                &.mine {
                    background-image: url("../../assets/imgs/icons/mine.png");
                }
            }
            // 当前激活路由图片
            &.router-link-active {
                .footbar-text{
                    color: #1C4B47;
                }
                .footbar-img.home {
                    background-image: url("../../assets/imgs/icons/home-active.png");
                }
                .footbar-img.kind {
                    background-image: url("../../assets/imgs/icons/kind-active.png");
                }
                .footbar-img.find {
                    background-image: url("../../assets/imgs/icons/find-active.png");
                }
                .footbar-img.mine {
                    background-image: url("../../assets/imgs/icons/mine-active.png");
                }
            }
            .footbar-text {
                padding-top: 5px;
                font-size: 12px;
                color: #8e8e93;
            }
        }
    }
}
</style>
```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

正函数 

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值