<template >
	<view>
		<u-tabbar v-model="myCurrent" :list="tabbarList" 
		:before-switch="beforeSwitch"
		:mid-button="true" active-color="#1677ff"></u-tabbar>
		
	</view>
</template>

<script>
 	
 	export default {
		name:"tabbarJob",
		props:{
			current: 0,
			id: 0
		},
		data() {
			return {
				activeColor:"#5098FF",
				oldindex:this.current,
				 myCurrent:this.current,
				 tabbarList: [{
				 		iconPath: "motuoche-diandongche",
				 		selectedIconPath: "motuoche-diandongche",
				 		text: '充电中',
				 		count: 0,
				 		isDot: true,
				 		customIcon: true,
						pagePath2:"/pages/index/index?k=1",
						
				 	},
				 	{
				 		iconPath: "/static/img/min_button_select.png",
				 		selectedIconPath: "/static/img/min_button_select.png",
				 		text: '充电',
				 		midButton: true,
				 		customIcon: true,
						pagePath2:"/pages/charge/index",
				 	},
				 	{
				 		iconPath: "31wode",
				 		selectedIconPath: "31wode",
				 		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;
				if(index==1){
						var id =this.carhelp.get("qr-default-id");
						if(!id){
							url="/pages/charge/switchCharge?index=1"
						}
				}
				uni.navigateTo({
					url: url
				})
				if(index==1){
					this.myCurrent=this.oldindex;
					return false;
				}else{
					return true;
				}
				
			},
			
		},mounted(){
			
		},destroyed(){
		}
		
	}
</script>

<style>
	 
</style>
