• 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;
          }
        }
      }
  • 相关阅读:
    GLSL
    c++ 的垃圾收集(garbage collector
    ZZ 红黑树,并非想象中的那么复杂
    【转载】我心目中的android机器档次
    代码优化
    qqww
    solve Ax+By+C=0
    the c10k problem
    标 题: 腾讯面试题目(PHP程序员)
    zz 软件开发流程工具一览
  • 原文地址:https://www.cnblogs.com/pycmsj/p/13084031.html
Copyright © 2020-2023  润新知