<template>
	<view class="">
		<view class="tabbar-box"></view>
		<view class="tabbar">
			<view
			 :class="{item : true, active : select == index}"
			 v-for="(item, index) in list"
			 :key="index"
			 @click="toPath(item, index)">
				<view class="icon">
					<image :src="select == index ? 
					item.selectedIconPath : 
					item.iconPath" class="icon-image" mode=""></image>
				</view>
				<view class="title">
					{{ item.title }}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { mapGetters } from 'vuex'
	export default {
		name:"tabbar",
		props : ['select'],
		data() {
			return {
				list : [
					{
						"selectedIconPath": "/static/image/tabbar/2.png",
						"iconPath": "/static/image/tabbar/1.png",
						"pagePath": "/pages/index/index",
						"title": "打卡"
					},
					{
						"selectedIconPath": "/static/image/tabbar/4.png",
						"iconPath": "/static/image/tabbar/3.png",
						"pagePath": "/pages/index/center",
						"title": "我的"
					}
				]
			};
		},
		methods : {
			toPath(item, index){
				if(index == this.select){
					return
				}
				uni.reLaunch({
					url: item.pagePath
				})
			},
		}
	}
</script>

<style scoped lang="scss">
.tabbar-box{
	height: 120rpx;
	// padding-bottom: env(safe-area-inset-bottom);
}
.tabbar{
	position: fixed;
	width: 750rpx;
	background-color: #fff;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: row;
	height: 120rpx;
	// padding-bottom: env(safe-area-inset-bottom);
	// padding: 10rpx 0rpx;
	z-index: 9999;
	bottom: 0;
	left: 0;
	color: #BCBCBC;
	border-top: 1px solid #ccc;
	.item{
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		.icon{
			width: 60rpx;
			height: 60rpx;
			.icon-image{
				width: 60rpx;
				height: 60rpx;
			}
		}
		.title{
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
			-o-text-overflow: ellipsis;
			font-size: 23rpx;
			line-height: 35rpx;
		}
	}
}
.active{
	color: $main-color;
}
</style>