Tabbar.vue 2.26 KB
<template>
  <div id="tabbar">
    <div class="tab" :class="active=='lecture'?'active':''" @click="handleLecture">
      <img v-if="active=='lecture'" src="../assets/tabbar1/tab1_on.png" alt="">
      <img v-else src="../assets/tabbar1/tab1_off.png" alt="">
      <p>公益讲座</p>
    </div>
    <div class="center">
      <img class="tip" src="../assets/tabbar1/tab2.png" alt="">
      <wx-open-launch-weapp id="launch-btn" username="gh_c0f904a5ee0c" path="pages/index/index?type=zkedt">
        <script type="text/wxtag-template">
          <style>.mini_btn { width:500px;height:500px;background:transparent;border:0; }</style>
            <button class="mini_btn"></button>
          </script>
      </wx-open-launch-weapp>
    </div>
    <div class="tab">
      <div class="block"></div>
      <p>志愿填报</p>
    </div>
    <div class="tab" :class="active=='center'?'active':''" @click="handleCenter">
      <img v-if="active=='center'" src="../assets/tabbar1/tab3_on.png" alt="">
      <img v-else src="../assets/tabbar1/tab3_off.png" alt="">
      <p>个人中心</p>
    </div>
  </div>
</template>
<script>
export default {
  name:'Tabbar',
  props:{
    active:String
  },
  mounted(){
    console.log(this.active)
  },
  methods:{
    // 点击讲座
    handleLecture(){
      this.$router.push({name:'Lecture'})
    },
    // 点击个人中心
    handleCenter(){
      this.$router.push({name:'Home'})
    }
  }
}
</script>
<style lang="scss">
#tabbar {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 100px;
  background: #fff;
  display: flex;
  justify-content: space-around;
  padding-bottom: 40px;
  .tab {
    
    padding: 18px;
    img {
      width: 52px;
      display: block;
      margin: 0 auto;
    }
    .block{
      width: 52px;
      height: 52px;
    }
    p {
      font-size: 20px;
      color: #999999;
      text-align: center;
    }
    &.active{
      p{
        color: #5789FF;
      }
    }
  }
  .center {
    width: 92px;
    height: 92px;
    padding: 30px;
    background: transparent;
    position: absolute;
    top: -60px;
    left: 299px;
    overflow: hidden;
    z-index: 1;
    .tip {
      width: 92px;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      z-index: -1;
    }
  }
}
</style>