smartswrtch-app/components/tab-bar/tab-bar.vue

118 lines
3.1 KiB
Vue
Raw Permalink Normal View History

<template>
2024-01-23 19:15:52 +08:00
<view class="cont">
2025-01-10 17:53:52 +08:00
<div class="tab" @tap.stop="changeTabbar(1)">
<image src="https://api.ccttiot.com/smartmeter/img/static/u9gW3B1zqhlwE8ugdPYh" mode="aspectFit" v-show="indexs!=1" style="width: 36rpx;height: 36rpx;"></image>
<image src="https://api.ccttiot.com/smartmeter/img/static/uXV4QEa9aGtzfTn00OhN" mode="aspectFit" v-show="indexs==1" style="width: 36rpx;height: 36rpx;"></image>
<div class="txt" :class="indexs==1?'act1':''">运营</div>
</div>
2024-01-24 11:55:35 +08:00
<div class="tab" @tap.stop="changeTabbar(0)">
2025-01-10 17:53:52 +08:00
<image src="https://api.ccttiot.com/smartmeter/img/static/uC1YPh9lkIkLJpRMGR9w" mode="aspectFit" v-show="indexs!=0"></image>
<image src="https://api.ccttiot.com/smartmeter/img/static/uhSzNe8wsWKPG0FaXX9A" mode="aspectFit" v-show="indexs==0"></image>
2024-08-06 18:04:09 +08:00
<div class="txt" :class="indexs==0?'act1':''">设备</div>
2024-01-24 11:55:35 +08:00
</div>
<div class="tab" @tap.stop="changeTabbar(2)">
2025-01-10 17:53:52 +08:00
<image src="https://api.ccttiot.com/smartmeter/img/static/uptAhTHptxf6z9W9rb4u" mode="aspectFit" v-show="indexs!=2" style="width: 36rpx;height: 40rpx;"></image>
<image src="https://api.ccttiot.com/smartmeter/img/static/uwpLaVyRo1fFkrR8ylI8" mode="aspectFit" v-show="indexs==2" style="width: 36rpx;height: 40rpx;"></image>
2024-07-27 18:43:42 +08:00
<div class="txt" :class="indexs==2?'act1':''">商户</div>
2024-01-24 11:55:35 +08:00
</div>
</view>
</template>
<script>
export default {
2024-01-23 19:15:52 +08:00
props: {
indexs: [Number, String], //题目id
},
data() {
2024-01-23 19:15:52 +08:00
return {
currentTabbarIndex: 0,
// 自定义底栏对应页面的加载情况
tabberPageLoadFlag: [],
ispop: false,
}
},
2024-01-23 19:15:52 +08:00
mounted() {
this.currentTabbarIndex = this.indexs
2024-05-10 19:51:14 +08:00
2024-01-23 19:15:52 +08:00
},
2024-01-24 11:55:35 +08:00
methods:{
changeTabbar(index) {
if (this.currentTabbarIndex === index) return
if(index==0){
uni.switchTab({
url:'/pages/index/index',
2024-01-27 16:37:52 +08:00
routeType: 'wx://modal',
2024-01-24 11:55:35 +08:00
success() {
this.currentTabbarIndex = index
}
})
console.log('点击了',index);
}else if(index==1){
uni.switchTab({
url:'/pages/tj',
2024-01-27 16:37:52 +08:00
routeType: 'wx://modal',
2024-01-24 11:55:35 +08:00
success() {
this.currentTabbarIndex = index
}
})
}else if(index==2){
uni.switchTab({
url:'/pages/my',
2024-01-27 16:37:52 +08:00
routeType: 'wx://modal',
2024-01-24 11:55:35 +08:00
success() {
this.currentTabbarIndex = index
}
})
}
},
}
}
</script>
<style lang="scss" scoped>
2024-01-23 19:15:52 +08:00
/deep/.u-tabbar__content__item__button {
top: 20rpx !important;
}
2024-01-23 19:15:52 +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;
2025-01-10 17:53:52 +08:00
left: 0;
bottom: 0;
width: 100%;
2024-01-23 19:15:52 +08:00
height: 128rpx;
background: #FFFFFF;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(53, 140, 255, 0.1);
2024-01-24 11:55:35 +08:00
display: flex;
align-items: center;
justify-content: space-around;
.tab{
2025-02-21 11:18:15 +08:00
width: 100rpx;
height: 100rpx;
display: block;
text-align: center;
2024-01-24 11:55:35 +08:00
image{
2025-01-10 17:53:52 +08:00
width: 40rpx;
height: 40rpx;
2024-01-24 11:55:35 +08:00
}
.txt{
margin-top: 10rpx;
font-size: 20rpx;
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
color: #95989D;
}
.act1{
color: #8883F0;
}
}
}
</style>