<template>
	<view>
		<u-tabbar v-model="myCurrent" :list="tabbarList" :before-switch="beforeSwitch" inactive-color="#ADB8C2" active-color="#5098FF">
		</u-tabbar>

	</view>
</template>

<script>
	var img1=require('@/assets/img/tabbarImg2/bar-chart-2-fill 2.svg')
	var img2=require('@/assets/img/tabbarImg2/bar-chart-2-fill.svg')
	var img3=require('@/assets/img/tabbarImg2/message-2-fill.svg') 
	var img4=require('@/assets/img/tabbarImg2/message-2-fill2.svg')
	var img5=require('@/assets/img/tabbarImg/chat-smile-2-fill.svg')
	var img6=require('@/assets/img/tabbarImg/chat-smile-2-fill2.svg')
	var img7=require('@/assets/img/tabbarImg/function-line .svg')
	var img8=require('@/assets/img/tabbarImg/function-line2.svg')
	export default {
		name: "Tabbar",
		props: {
			current: 0,
			elderStatus: false
		},
		data() {
			return {
				oldindex: this.current,
				myCurrent: this.current,
				tabbarList: [{

						iconPath: img1,
						selectedIconPath: img2,
						text: '主页 ',
						pagePath2: "/pages/statistics/statistics",
					},
					{
					
							iconPath: img7,
							selectedIconPath: img8,
							text: '应用 ',
							pagePath2: "/pages/mine/myApps",
						},
					 
					// {
					// 	iconPath: img3,
					// 	selectedIconPath: img4,
					// 	text: '消息',
					// 	pagePath2: "/pages/mine/message",
						
					// },
					
					{
						iconPath: img5,
						selectedIconPath: img6,
						text: '我的',
						pagePath2: "/pages/mine/mine",
					}
				],
			};

		},
		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() {

		},
		destroyed() {

		}


	}
</script>

<style>

</style>
