文章阅读

沉浸阅读完整内容

写文章

vue 底部选项卡

正在统计阅读人数 正在统计字数
登录收藏0
字号 100%

<template>
    <div class="layout">
        <router-view />
        <div class="navbar_bottom">
            <ul>
                <li @click="to(v, i)" v-for="(v, i) in tab" :key="i" :class="{ active: active === i }">{{ v.name }}</li>
            </ul>
        </div>
    </div>
</template>

<script>
export default {
    data: () => ({
        tab: [
            { name: "首页", to: '/layout/index' },
            { name: "运动", to: '/' },
            { name: "圈子", to: '/' },
            { name: "我的", to: '/' },
        ],
        active: 0
    }),
    methods: {
        to(v, i) {
            console.log(v, i);
            this.$router.push(v.to)
            this.active = i
        }
    }
}
</script>

<style lang="scss" scoped>
.layout {
    height: 100%;
    background-color: rgb(0, 121, 177);

    .navbar_bottom {
        width: 100%;
        height: 50px;
        position: fixed;
        bottom: 0;
        left: 0;
        background-color: #fff;

        ul {
            width: 100%;
            height: 100%;
            display: flex;
            font-size: 16px;
            justify-content: space-around;
            align-items: center;

            li {
                &.active {
                    color: #00d1ec;
                }
            }
        }
    }

}
</style>

推荐阅读

4 篇精选
文章 / 86vue 组件通信传递参数(父传子) 文章 / 89vue 组件通信传递参数(任意组件传递) 文章 / 85vue 打包配置 文章 / 87vue 组件通信传递参数(子传父)

发表评论

评论 0

还没有评论,欢迎留下第一条讨论。

分享精彩,传递价值

生成专属海报,分享你的文章,让更多人发现好内容

浏览器不支持 Canvas,无法生成海报。

每日签到

每天来这里,记录一点持续积累。

当前积分--积分
本月签到--
本月获得--积分
正在读取