跳到主要内容
青山指南正在为您准备页面
医疗级专业核验
透明收费 · 拒绝隐形 每天 08:00-20:00
资讯

vue 底部选项卡

养老服务、照护经验与行业动态,为家庭提供实用参考。

vue 底部选项卡
<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>
咨询顾问返回首页
分享经验

发表评论

读者交流

全部评论

0

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