<template> <div id="tabbar"> <div class="tab" :class="active=='service'?'active':''" @click="handleQYX"> <img v-if="active=='service'" src="@/assets/tabbar/tab1_on.png" alt=""> <img v-else src="@/assets/tabbar/tab1_off.png" alt=""> <p>绍兴研学</p> </div> <div class="tab" :class="active=='grow'?'active':''" @click="handleGrowUp"> <img v-if="active=='grow'" src="@/assets/tabbar/tab2_on.png" alt=""> <img v-else src="@/assets/tabbar/tab2_off.png" alt=""> <p>成长记录</p> </div> <div class="tab" :class="active=='home'?'active':''" @click="handleHome"> <img v-if="active=='home'" src="@/assets/tabbar/tab3_on.png" alt=""> <img v-else src="@/assets/tabbar/tab3_off.png" alt=""> <p>我的</p> </div> </div> </template> <script> export default { name: 'Tabbar', props: { active: String }, methods: { handleQYX () { this.$router.push({ name: 'Home'}) }, handleGrowUp () { this.$router.push({ name: 'GrowUpRecord'}) }, handleHome(){ this.$router.push({ name: 'HomeYX'}) } } } </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: 46px; display: block; margin: 0 auto; } p { font-size: 20px; color: #999999; text-align: center; margin-top: 14px; } } } </style> <style lang="scss"> // 长辈版 .elder { #tabbar { padding-top: 30px; .tab{ padding: 0; img{ width: 44px; } p{ font-size: 34px; } } } } </style>