cankao-h5/src/components/mini/Tabbar.vue

70 lines
2.0 KiB
Vue

<template>
<view class="tabbar">
<view class="tabbar_item" @click="tabChange(0)">
<image v-if="tabIndex == 1"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/zixun/home_icon_normal.png"
class="tabbar_img" />
<image v-if="tabIndex == 0"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/zixun/home_icon_press.png"
class="tabbar_img" />
<text class="tabbar_title" :style="{ color: tabIndex == 0 ? '#3F80FA' : '#666666' }">首页</text>
</view>
<view class="tabbar_item" @click="tabChange(1)">
<image v-if="tabIndex == 0"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/zixun/all_icon_normal.png"
class="tabbar_img" />
<image v-if="tabIndex == 1"
src="https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/zixun/all_icon_press.png" class="tabbar_img" />
<text class="tabbar_title" :style="{ color: tabIndex == 1 ? '#3F80FA' : '#666666' }">全部</text>
</view>
</view>
</template>
<script setup>
import { ref, onMounted, onUnmounted, reactive } from "vue";
const tabIndex = ref(0);
function tabChange(index) {
tabIndex.value = index;
}
onMounted(async () => { });
</script>
<style scoped lang="scss">
.tabbar {
display: flex;
height: 150rpx;
position: fixed;
bottom: 0;
box-shadow: 0 -2rpx 10rpx rgba(128, 128, 128, 0.2);
width: 100vw;
.tabbar_item {
width: 50%;
display: flex;
flex-direction: column;
align-items: center;
margin-top: 30rpx;
}
.tabbar_img {
width: 44rpx;
height: 44rpx;
}
.tabbar_title {
display: flex;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 20rpx;
color: #666666;
line-height: 28rpx;
text-align: left;
font-style: normal;
margin-top: 5rpx;
}
}
</style>