<template>
	<view class="bottom_tabbar">
		<view v-for="(item,index) in list" :key="index" @tap="changeTabbar(index)">
			<image :src="tabbarIndex===index?item.activeImg:item.inactiveImg"></image>
			<text :class="{'active':tabbarIndex===index}">{{item.text}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			tabbarIndex: 0
		},
		data() {
			return {
				tabbarValue: 0,
				list: [
					// {
					// 	inactiveImg: this.$imgBase+'icon_home_grey.png',
					// 	activeImg: this.$imgBase+'icon_home_blue.png',
					// 	text: '首页',
					// 	path: '/pagesHome/index'
					// },
					{
						inactiveImg: this.$imgBase+'icon_storage_grey.png',
						activeImg: this.$imgBase+'icon_storage_blue.png',
						text: '仓储管理',
						path: '/pagesStorage/home'
					},
					{
						inactiveImg: this.$imgBase+'icon_code_grey.png',
						activeImg: this.$imgBase+'icon_code_blue.png',
						text: '扫码',
						path: '/pagesCode/index'
					},
				],
				loginSuccessUrl:''
			}
		},
		mounted() {
			this.tabbarValue = this.tabbarIndex;
		},
		methods: {
			changeTabbar(e) {
				this.tabbarValue = e;
				uni.reLaunch({
					url: this.list[e].path
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.bottom_tabbar {
		width: 100%;
		height: 168rpx;
		background: #FFFFFF;
		display: flex;
		position: fixed;
		left: 0;
		bottom: 0;
		z-index: 999;
		padding-top: 10rpx;
		box-sizing: border-box;
		border-top: 1rpx solid lavender;

		&>view {
			width: calc(100% / 2);
			height: 100%;
			display: flex;
			flex-direction: column;
			align-items: center;

			image {
				width: 48rpx;
				height: 48rpx;
			}

			text {
				margin-top: 6rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 24rpx;
				color: #86909C;
				line-height: 33rpx;
				text-align: center;
				&.active{
					font-weight: bold;
					color: #198CFF;
				}
			}
		}
	}
</style>