<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/tabbarImg/home-wifi-fill.svg')
	var img2=require('@/assets/img/tabbarImg/home-wifi-fill2.svg')
	var img3=require('@/assets/img/tabbarImg/chat-1-fill.svg')
	var img4=require('@/assets/img/tabbarImg/chat-1-fill2.svg')
	var img5=require('@/assets/img/tabbarImg/chat-smile-2-fill.svg')
	var img6=require('@/assets/img/tabbarImg/chat-smile-2-fill2.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/index/index",
					},
					 
					{
						iconPath: img3,
						selectedIconPath: img4,
						text: '消息',
						pagePath2: "/pages/message/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>
