<template> <div id="tabbar"> <div class="tab" :class="active=='KQ'?'active':''" @click="handleKQ"> <img v-if="active=='KQ'" src="../assets/tabbar4/tab3_on.png" alt=""> <img v-else src="../assets/tabbar4/tab3_off.png" alt=""> <p>柯桥研学</p> </div> <div class="tab" :class="active=='yanxue'?'active':''" @click="handYanxue"> <img v-if="active=='yanxue'" src="../assets/tabbar4/tab2_on.png" alt=""> <img v-else src="../assets/tabbar4/tab2_off.png" alt=""> <p>每日一习</p> </div> <div class="tab" :class="active=='rank'?'active':''" @click="handleRank"> <img v-if="active=='rank'" src="../assets/rank/rank_on.png" alt=""> <img v-else src="../assets/rank/rank.png" alt=""> <p>排行榜</p> </div> <div class="tab" :class="active=='fruit'?'active':''" @click="handleFruit"> <img v-if="active=='fruit'" src="../assets/tabbar4/fruit_on.png" alt=""> <img v-else src="../assets/tabbar4/fruit_off.png" alt=""> <p>研学成果</p> </div> <div class="tab" :class="active=='center'?'active':''" @click="handleCenter"> <img v-if="active=='center'" src="../assets/tabbar4/tab4_on.png" alt=""> <img v-else src="../assets/tabbar4/tab4_off.png" alt=""> <p>我的</p> </div> </div> </template> <script> export default { name: 'Tabbar4', props: { active: String }, methods: { handYanxue () { // this.$router.push({ name: 'ServiceKQ', query: { showTab: 'ZZY' },replace:true }) this.$router.replace({ path:'/YanxuePage' }) }, handleKQ () { // this.$router.push({ name: 'ServiceKQ', query: { showTab: 'KQ' },replace:true }) this.$router.replace({ path:'/' , query: { showTab: 'KQ' }}) }, handleCenter () { this.$router.replace({ path:'/home' }) }, handleFruit() { // this.$router.replace({ path:'/achievements' }) this.$router.replace({ path:'/achievementsOne' }) }, handleRank() { this.$router.replace({ path:'/rank' }) } } } </script> <style lang="scss" scoped> #tabbar { position: fixed; bottom: 0; width: 100%; height: 100px; background: #fff; display: flex; justify-content: space-around; padding-bottom: 40px; z-index: 99; .tab { padding: 18px; img { width: 36px; padding: 20px; display: block; margin: 0 auto; } .block { width: 52px; height: 52px; } p { font-size: 20px; color: #999999; text-align: center; } &.active { p { color: red; } } } .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> <style lang="scss"> // 长辈版 .elder { #tabbar { .tab{ padding: 0; img{ width: 44px; } p{ font-size: 34px; } } } } </style>