bottomTab.vue 1.99 KB
<template>
  <div class="bottom-tab">
    <div :class="{actived:$route.name === 'index',left:true}" @click="toUrl('index')">
      <i class="iconfont icon-zhuye"></i>
      <br>
      首页
    </div>
    <div :class="{actived:$route.name === 'mine'}" @click="toUrl('mine')">
      <i class="iconfont icon-wode"></i>
      <br>
      我的
    </div>
  </div>
</template>

<script>
  export default {
    name: "bottomTab",
    data(){return{}},
    methods:{
      toUrl(data){
        this.$sa.track('buttonClick',{
          tabTitle:'底部导航',
          moduleTitle:'功能按钮',
          buttonType:'切换按钮',
          buttonName:data === 'index' ? '切换到首页' : '切换到我的'
        });
        this.$router.push({name:data})
      }
    }
  }
</script>

<style scoped lang="less">
  @import "../../util/public";
  .bottom-tab{
    width: 375*@toVw;
    height: 48*@toVw;
    position: fixed;
    left: 0;
    bottom: 0;
    box-shadow:0px -1px 2px 0px rgba(204,204,204,0.5);
    padding: 0 6*@toVw;
    display: flex;
    font-size:10px;
    font-family:PingFang-SC-Medium;
    text-align: center;
    font-weight:normal;
    color:#ccc;
    line-height:14px;
    z-index: 30;
    background: white;
    &>div{
      width: 50%;
    }
    .left{
      border-right: 1px solid #eeeeee;
    }
    .actived{
      color: #6EB1FF;
    }

  }

  @media screen and (orientation: landscape) {
    @toVw:100/667vw;
    .bottom-tab{
      width: 667*@toVw;
      height: 30*@toVw;
      position: fixed;
      left: 0;
      bottom: 0;
      box-shadow:0px -1px 2px 0px rgba(204,204,204,0.5);
      padding: 0 6*@toVw;
      display: flex;
      font-size:10px;
      font-family:PingFang-SC-Medium;
      text-align: center;
      font-weight:normal;
      color:#ccc;
      line-height:14px;
      z-index: 30;
      background: white;
      &>div{
        width: 50%;
      }
      .left{
        border-right: 1px solid #eeeeee;
      }
      .actived{
        color: #6EB1FF;
      }

    }
  }

</style>