zoukankan      html  css  js  c++  java
  • vue底部导航组件

    <div class="footer">
        <ul class="flex width-full">
            <li class="footer-item" @click="switchTo('/index')">
            <img :src="'/index' === $route.path ? imgList[0].selected : imgList[0].normal">
                <p :class="{activeColor:'/index' === $route.path}">首页</p>
        </li>
            <li class="footer-item" @click="switchTo('/find')">
            <img :src="'/find' === $route.path ? imgList[1].selected : imgList[1].normal">
                 <p :class="{activeColor:'/find' === $route.path}">发现</p>
        </li>
        <li class="footer-item" @click="switchTo('/user')">
             <img :src="'/user' === $route.path ? imgList[2].selected : imgList[2].normal">
                  <p :class="{activeColor:'/user' === $route.path}">我的</p>
        </li>
        </ul>
    </div>         
    
    
    data(){
        return{
            imgList:[
             {normal:'static/images/footer/index.png',selected:'static/images/footer/index_active.png'},
              {normal:'static/images/footer/find.png',selected:'static/images/footer/find_active.png'},
              {normal:'static/images/footer/user.png',selected:'static/images/footer/user_active.png'},
            ]
        }
    },         
    
    
    methods:{
          switchTo(path){
            console.log(this.$router);
            this.$router.replace(path);
          }
    },    
    
    .footer{
        100%;
        height:0.98rem;
        background-color:#fff;
        position:fixed;
        left:0;
        bottom:0;
        z-index:999;
        .footer-item{
          text-align:center;
          font-size:0.24rem;
          color:#666;
          img{
            margin-top: 0.1rem;
            0.48rem;
            height: 0.48rem;
          }
          .activeColor{
            color:#ff6600;
          }
        }
      }
  • 相关阅读:
    简单的自我介绍
    学习总结(北航助教陈彦吉)
    2019春季第十二周助教总结
    2019春季第十一周助教总结
    第十一周作业
    2019春季第十周助教总结
    2019春季第九周助教总结
    第九周作业
    2019春季第八周助教总结
    第八周作业
  • 原文地址:https://www.cnblogs.com/pycmsj/p/13084031.html
Copyright © 2011-2022 走看看