<template>
|
<view class="tabBar">
|
<view class="tabBar_list">
|
<view v-for="(item,index) in tabBar" :key="item.url" class="tabbar_item" :class="{'active':item.url == currentPage}" @click="navTo(item)">
|
<template v-if="item.url">
|
<image v-if="item.url == currentPage" :src="item.imgClick" mode="widthFix"></image>
|
<image v-else :src="item.imgNormal" mode="widthFix"></image>
|
<view class="text">{{item.text}}</view>
|
</template>
|
<view class="tabbar_quan" v-else></view>
|
</view>
|
</view>
|
<view class="tabBar_zw"></view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
props: {
|
currentPage: {
|
type: String,
|
default: 'index'
|
}
|
},
|
data() {
|
return {
|
value: 1,
|
tabBar: [
|
{
|
url: '/pages/myPolicy/myPolicy',
|
text: '保单',
|
imgNormal: '../../static/icon/nav_home@2x.png',
|
imgClick: '../../static/icon/nav_home_sel@2x.png'
|
},
|
{
|
url: '/pages/online_reporting/online_reporting',
|
text: '理赔',
|
imgNormal: '../../static/icon/nav_lipei@2x.png',
|
imgClick: '../../static/icon/nav_lipei_sel@2x.png'
|
},
|
{
|
url: '',
|
text: ''
|
},
|
{
|
url: '/pages/changeRecord/changeRecord',
|
text: '变更记录',
|
imgNormal: '../../static/icon/nav_biangeng@2x.png',
|
imgClick: '../../static/icon/nav_biangeng_sel@2x.png'
|
},
|
{
|
url: '/pages/mine/mine',
|
text: '我的',
|
imgNormal: '../../static/icon/nav_wode@2x.png',
|
imgClick: '../../static/icon/nav_wode_sel@2x.png'
|
}
|
]
|
};
|
},
|
methods: {
|
navTo(item) {
|
if (item.url !== this.currentPage) {
|
var isUrl = item.url
|
const that = this
|
uni.switchTab({
|
url: isUrl
|
})
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
//导航栏设置
|
$isRadius: 20upx; //左上右上圆角
|
$isWidth: 100vw; //导航栏宽度
|
$isBorder: 0px solid white; //边框 不需要则设为0px
|
$isBg: white; //背景
|
|
// 选中设置
|
$chooseTextColor: #222222; //选中时字体颜色
|
$chooseBgColor: transparent; //选中时背景颜色 transparent为透明
|
|
//未选中设置
|
$normalTextColor: #312F32; //未选中颜色
|
|
.tabBar {
|
width: 100vw;
|
// height: 110upx;
|
// padding-bottom: env(safe-area-inset-bottom);
|
position: fixed;
|
bottom: 0;
|
left: 0;
|
right: 0;
|
z-index: 988;
|
background-color: $isBg;
|
color: $normalTextColor;
|
display: flex;
|
flex-direction: column;
|
|
.tabBar_zw {
|
width: 100vw;
|
height: env(safe-area-inset-bottom);
|
}
|
|
.tabBar_list {
|
width: 100vw;
|
height: 110upx;
|
background-color: $isBg;
|
color: $normalTextColor;
|
display: flex;
|
justify-content: space-around;
|
box-sizing: border-box;
|
overflow: hidden;
|
|
.tabbar_item {
|
flex: 1;
|
font-size: 12px;
|
display: flex;
|
flex-direction: column;
|
justify-content: center;
|
align-items: center;
|
position: relative;
|
|
.tabbar_quan {
|
width: 40px;
|
height: 40px;
|
background: #437CB3;
|
border-radius: 20px;
|
border: 3px solid rgba(67,124,179,0.14);
|
}
|
|
.tabbar_item_hot {
|
position: absolute;
|
left: 50%;
|
top: 25upx;
|
transform: translate(0, -50%);
|
width: 30rpx;
|
height: 30rpx;
|
line-height: 30rpx;
|
text-align: center;
|
background-color: red;
|
border-radius: 50%;
|
color: #ffffff;
|
font-size: 18rpx;
|
z-index: 9;
|
}
|
|
&.active {
|
border-left: $isBorder;
|
border-top: $isBorder;
|
background: $chooseBgColor;
|
color: $chooseTextColor;
|
}
|
}
|
|
image {
|
width: 48upx;
|
height: 48upx;
|
}
|
}
|
}
|
</style>
|