2023-12-18 22:45:53 +08:00
|
|
|
|
<template>
|
2024-01-23 19:15:52 +08:00
|
|
|
|
<view class="cont">
|
2024-01-24 11:55:35 +08:00
|
|
|
|
<div class="tab" @tap.stop="changeTabbar(0)">
|
|
|
|
|
<image src="@/static/tabbar/home.png" mode="" v-show="indexs!=0"></image>
|
|
|
|
|
<image src="@/static/tabbar/home-active.png" mode="" v-show="indexs==0"></image>
|
|
|
|
|
<div class="txt" :class="indexs==0?'act1':''">首页</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tab" @tap.stop="changeTabbar(1)">
|
|
|
|
|
<image src="@/static/tabbar/tj.png" mode="" v-show="indexs!=1" style="width: 36rpx;height: 36rpx;"></image>
|
|
|
|
|
<image src="@/static/tabbar/tj-active.png" mode="" v-show="indexs==1" style="width: 36rpx;height: 36rpx;"></image>
|
|
|
|
|
<div class="txt" :class="indexs==1?'act1':''">统计</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tab" @tap.stop="changeTabbar(2)">
|
|
|
|
|
<image src="@/static/tabbar/my.png" mode="" v-show="indexs!=2" style="width: 28rpx;height: 36.4rpx;"></image>
|
|
|
|
|
<image src="@/static/tabbar/my-active.png" mode="" v-show="indexs==2" style="width: 28rpx;height: 36.4rpx;"></image>
|
|
|
|
|
<div class="txt" :class="indexs==2?'act1':''">我的</div>
|
|
|
|
|
</div>
|
2024-01-23 19:15:52 +08:00
|
|
|
|
<!-- <view class="u-page">
|
|
|
|
|
|
|
|
|
|
</view> -->
|
2023-12-18 22:45:53 +08:00
|
|
|
|
<!-- 与包裹页面所有内容的元素u-page同级,且在它的下方 -->
|
2024-01-23 19:15:52 +08:00
|
|
|
|
<!-- <u-tabbar v-model="current" :list="list" icon-size='40rpx' active-color='#3996fd' inactive-color="#c8c7cb"></u-tabbar> -->
|
2023-12-18 22:45:53 +08:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
2024-01-23 19:15:52 +08:00
|
|
|
|
props: {
|
|
|
|
|
indexs: [Number, String], //题目id
|
|
|
|
|
},
|
2023-12-18 22:45:53 +08:00
|
|
|
|
data() {
|
2024-01-23 19:15:52 +08:00
|
|
|
|
return {
|
|
|
|
|
currentTabbarIndex: 0,
|
|
|
|
|
|
|
|
|
|
// 自定义底栏对应页面的加载情况
|
|
|
|
|
tabberPageLoadFlag: [],
|
|
|
|
|
ispop: false,
|
2023-12-18 22:45:53 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-01-23 19:15:52 +08:00
|
|
|
|
mounted() {
|
|
|
|
|
this.currentTabbarIndex = this.indexs
|
|
|
|
|
// const index = Number(this.indexs || 0)
|
|
|
|
|
// // 根据底部tabbar菜单列表设置对应页面的加载情况
|
|
|
|
|
// for (let i = 0; i < 5; i++) {
|
|
|
|
|
// this.tabberPageLoadFlag.push(i === index)
|
|
|
|
|
// }
|
|
|
|
|
// this.changeTabbar(index)
|
|
|
|
|
},
|
2024-01-24 11:55:35 +08:00
|
|
|
|
methods:{
|
|
|
|
|
changeTabbar(index) {
|
|
|
|
|
|
|
|
|
|
if (this.currentTabbarIndex === index) return
|
|
|
|
|
// this._switchTabbarPage(index)
|
|
|
|
|
|
|
|
|
|
if(index==0){
|
|
|
|
|
uni.switchTab({
|
|
|
|
|
url:'/pages/index/index',
|
|
|
|
|
success() {
|
|
|
|
|
this.currentTabbarIndex = index
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
console.log('点击了',index);
|
|
|
|
|
}else if(index==1){
|
|
|
|
|
uni.switchTab({
|
|
|
|
|
url:'/pages/tj',
|
|
|
|
|
success() {
|
|
|
|
|
this.currentTabbarIndex = index
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else if(index==2){
|
|
|
|
|
uni.switchTab({
|
|
|
|
|
url:'/pages/my',
|
|
|
|
|
success() {
|
|
|
|
|
this.currentTabbarIndex = index
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
2023-12-18 22:45:53 +08:00
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
2024-01-23 19:15:52 +08:00
|
|
|
|
/deep/.u-tabbar__content__item__button {
|
2023-12-18 22:45:53 +08:00
|
|
|
|
top: 20rpx !important;
|
|
|
|
|
}
|
2024-01-23 19:15:52 +08:00
|
|
|
|
|
2023-12-20 22:11:29 +08:00
|
|
|
|
/deep/.u-tabbar {
|
2024-01-23 19:15:52 +08:00
|
|
|
|
.u-tabbar__content__item:nth-child(2) {
|
|
|
|
|
.u-tabbar__content__item__button {
|
|
|
|
|
width: 32rpx !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.cont {
|
|
|
|
|
position: fixed;
|
|
|
|
|
left: 60rpx;
|
|
|
|
|
bottom: 78rpx;
|
|
|
|
|
width: 632rpx;
|
|
|
|
|
height: 128rpx;
|
|
|
|
|
background: #FFFFFF;
|
|
|
|
|
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(53, 140, 255, 0.1);
|
|
|
|
|
border-radius: 60rpx;
|
2024-01-24 11:55:35 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
.tab{
|
|
|
|
|
width: 44rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
image{
|
|
|
|
|
width: 30rpx;
|
|
|
|
|
height: 30rpx;
|
|
|
|
|
}
|
|
|
|
|
.txt{
|
|
|
|
|
margin-top: 10rpx;
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
color: #95989D;
|
|
|
|
|
}
|
|
|
|
|
.act1{
|
|
|
|
|
color: #8883F0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-20 22:11:29 +08:00
|
|
|
|
}
|
2023-12-18 22:45:53 +08:00
|
|
|
|
</style>
|