<template >
	<view >
		<u-tabbar 
		:class="{
			springclass:spring
		}"
		v-model="myCurrent" :list="tabbarList" 
		:inactiveColor="inColor" :bgColor="bgColor"
		:before-switch="beforeSwitch" :activeColor="acColor" :height="spring?('120rpx' ):(elderStatus ? '120rpx' : '110rpx')" :icon-size="elderStatus ? '56rpx' : '40rpx'"></u-tabbar>
		
	</view>
</template>

<script>
	
	 
 	export default {
		name:"tabbarJob",
		props:{
			spring:false,
			current: 0,
			elderStatus: false,
			bgColor: {
				type: String,
				default: '#ffffff'
			},
			inColor: {
				type: String,
				default: '#A8B0AD'
			},
			acColor: {
				type: String,
				default: '#009143'
			},
		},
		data() {
			return {
				activeColor:"#5098FF",
				oldindex:this.current,
				 myCurrent:this.current,
				 tabbarList: [{
				 		iconPath: "home-3-line",
				 		selectedIconPath: "home-3-fill",
				 		text: '主页 ',
						
				 		count: 0,
				 		isDot: true,
				 		customIcon: true,
						pagePath2:"/pages/index/index",
				 	},
					{
						// iconPath: img4,
						// selectedIconPath: img3,
						iconPath: "gift",
						selectedIconPath: "gift-fill",
						
						text: '活动',
						midButton: true,
						//customIcon: true,
						pagePath2:"/pages/index/activity",
					},
				 	{
				 		iconPath: "road-map-line",
				 		selectedIconPath: "road-map-fill",
				 		text: '找桩',
				 		midButton: true,
				 		customIcon: true,
						pagePath2:"/pages/searchPile/searchPile",
				 	},
				 	{
				 		iconPath: "user-5-line",
				 		selectedIconPath: "user-5-fill",
				 		text: '我的',
				 		count: 0,
				 		isDot: false,
				 		customIcon: true,
						pagePath2:"/pages/user/index",
				 	}
			 ],
			};
			
		},methods:{
			setcount(c){
				this.myCurrent=c
			},
			beforeSwitch(index){
			
				
				if(index==this.current){
					return false
				}
				var url =this.tabbarList[index].pagePath2;
				
				uni.navigateTo({
					url: url
				})
				if(index==1){
					this.myCurrent=this.oldindex;
					return false;
				}else{
					return true;
				}
				
			},
			
		},mounted(){
			console.log("mountedmountedmountedmountedmounted")
			if(this.spring){
				var img1=require('@/assets/img/spring/2025/index2.png')
				var img2=require('@/assets/img/spring/2025/index3.png')
				
				var img3=require('@/assets/img/spring/2025/index4.png')
				var img4=require('@/assets/img/spring/2025/index5.png')
				 
				this.tabbarList[0].iconPath=img1
				this.tabbarList[0].selectedIconPath=img1
				this.tabbarList[1].iconPath=img2
				this.tabbarList[1].selectedIconPath=img2
				this.tabbarList[2].iconPath=img3
				this.tabbarList[2].selectedIconPath=img3
				this.tabbarList[3].iconPath=img4
				this.tabbarList[3].selectedIconPath=img4
				this.acColor="red"
				
				
				
			}
		},destroyed(){
			
		}
		
		
	}
</script>

<style>
	
</style>
