<template>
|
|
<view class="">
|
|
<view class="tabbar-box"></view>
|
|
<view class="tabbar">
|
|
<view
|
|
:class="{item : true, active : select == index}"
|
|
v-for="(item, index) in list"
|
|
:key="index"
|
|
@click="toPath(item, index)">
|
|
<view class="icon">
|
|
<image :src="select == index ?
|
|
item.selectedIconPath :
|
|
item.iconPath" class="icon-image" mode=""></image>
|
|
</view>
|
|
<view class="title">
|
|
{{ item.title }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters } from 'vuex'
|
|
export default {
|
|
name:"tabbar",
|
|
props : ['select'],
|
|
data() {
|
|
return {
|
|
list : [
|
|
{
|
|
"selectedIconPath": "https://tennis-oss.xzaiyp.top/2024-10-22/5cc4afa9-e951-4503-95c8-c0332a8f5db9.png",
|
|
"iconPath": "https://tennis-oss.xzaiyp.top/2024-10-22/9caa43b2-8389-4945-8b71-9b49bca2d634.png",
|
|
"pagePath": "/pages/index/index",
|
|
"title": "打卡"
|
|
},
|
|
{
|
|
"selectedIconPath": "https://tennis-oss.xzaiyp.top/2024-10-22/62bc1e85-24b3-4f72-a31d-4caad77590e9.png",
|
|
"iconPath": "https://tennis-oss.xzaiyp.top/2024-10-22/6b9c937e-487c-4552-8140-dad098d7f16e.png",
|
|
"pagePath": "/pages/index/center",
|
|
"title": "我的"
|
|
}
|
|
]
|
|
};
|
|
},
|
|
methods : {
|
|
toPath(item, index){
|
|
if(index == this.select){
|
|
return
|
|
}
|
|
uni.reLaunch({
|
|
url: item.pagePath
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.tabbar-box{
|
|
height: 120rpx;
|
|
// padding-bottom: env(safe-area-inset-bottom);
|
|
}
|
|
.tabbar{
|
|
position: fixed;
|
|
width: 750rpx;
|
|
background-color: #fff;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
flex-direction: row;
|
|
height: 120rpx;
|
|
// padding-bottom: env(safe-area-inset-bottom);
|
|
// padding: 10rpx 0rpx;
|
|
z-index: 9999;
|
|
bottom: 0;
|
|
left: 0;
|
|
color: #BCBCBC;
|
|
border-top: 1px solid #ccc;
|
|
.item{
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
.icon{
|
|
width: 60rpx;
|
|
height: 60rpx;
|
|
.icon-image{
|
|
width: 60rpx;
|
|
height: 60rpx;
|
|
}
|
|
}
|
|
.title{
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
-o-text-overflow: ellipsis;
|
|
font-size: 23rpx;
|
|
line-height: 35rpx;
|
|
}
|
|
}
|
|
}
|
|
.active{
|
|
color: $main-color;
|
|
}
|
|
</style>
|