<template>
	<view class="list bx popup-bx">
		<view
		 :class="{item : true, active : select == index}"
		 @click="toPath(item, index)"
		 v-for="(item, index) in list">
			<view class="icon">
				<image :src="'/static/tabbar/' + (index + 1) + '.png'" class="icon-image" mode=""></image>
			</view>
			<view class="title">
				{{ $t(item.title) }}
			</view>
		</view>
	</view>
</template>
<!-- "tabBar": {
		"backgroundColor": "white",
		"selectedColor": "#cd0000",
		"list": [
			{
				"selectedIconPath": "/static/tabbar/2.png",
				"iconPath": "/static/tabbar/1.png",
				"pagePath": "pages/home/home",
				"text": "%tabbar.title.1%"
			},{
				"selectedIconPath": "/static/tabbar/4.png",
				"iconPath": "/static/tabbar/3.png",
				"pagePath": "pages/cart/cart",
				"text": "%tabbar.title.2%"
			},{
				"selectedIconPath": "/static/tabbar/6.png",
				"iconPath": "/static/tabbar/5.png",
				"pagePath": "pages/order/order",
				"text": "%tabbar.title.3%"
			}
		]
	} -->
<script>
	export default {
		props : ['select'],
		data() {
			return {
				// "list": [
				// 	{
				// 		"selectedIconPath": "/static/tabbar/2.png",
				// 		"iconPath": "/static/tabbar/1.png",
				// 		"pagePath": "/pages/home/home",
				// 		"title": "tabbar.title.1"
				// 	},{
				// 		"selectedIconPath": "/static/tabbar/4.png",
				// 		"iconPath": "/static/tabbar/3.png",
				// 		"pagePath": "/pages/prizeDraw/prizeDraw",
				// 		"title": "tabbar.title.2"
				// 	},{
				// 		"selectedIconPath": "/static/tabbar/6.png",
				// 		"iconPath": "/static/tabbar/5.png",
				// 		"pagePath": "/pages/order/order",
				// 		"title": "tabbar.title.3"
				// 	},{
				// 		"selectedIconPath": "/static/tabbar/8.png",
				// 		"iconPath": "/static/tabbar/7.png",
				// 		"pagePath": "/pages/center/center",
				// 		"title": "tabbar.title.4"
				// 	}
				// ],
				"list": [
					{
						"pagePath": "/pages/home/home",
						"title": "tabbar.title.1"
					},
					{
						"pagePath": "/pages/order/order",
						"title": "tabbar.title.2"
					},
					{
						"pagePath": "/pages/starting/starting",
						"title": "tabbar.title.3"
					},
					{
						"title": "tabbar.title.4"
					},
					{
						"pagePath": "/pages/center/center",
						"title": "tabbar.title.5"
					}
				]
			}
		},
		methods: {
			toPath(item, index){
				if(index == this.select){
					return
				}
				
				if(!item.pagePath){
					return
				}
				
				this.$play()
				uni.redirectTo({
					url: item.pagePath
				})
			},
		}
	}
</script>

<style scoped lang="scss">
.list{
	position: fixed;
	width: 100vw;
	background-color: #000;
	display: flex;
	justify-content: center;
	align-items: center;
	height: 120rpx;
	z-index: 999;
	font-size: 20rpx;
	bottom: 0;
	left: 0;
	line-height: 50rpx;
	color: #fff;
	box-shadow: 0px 0rpx 10rpx 10rpx #00000022;
	width: 750rpx;
	font-weight: 500;
	.item:nth-child(2){
		// .icon{
		// 	.icon-image{
		// 		width: 95rpx;
		// 		height: 95rpx;
		// 		margin-top: -55rpx;
		// 	}
		// }
	}
	.item{
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		.icon{
			width: 100%;
			height: 50%;
			display: flex;
			justify-content: center;
			align-items: center;
			.icon-image{
				width: 45rpx;
				height: 45rpx;
			}
		}
		.icon-image{
			width: 100%;
			height: 50%;
		}
		.title{
			overflow:hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
			-o-text-overflow:ellipsis;
		}
	}
}
.active{
	color: rgb(92, 173, 255) !important;
}
</style>
