<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: require('@/static/tab_home.png'),
						activeImg: require('@/static/tab_home_active.png'),
						text: '首页',
						path: '/pages/home'
					},
					{
						inactiveImg: require('@/static/tab_my.png'),
						activeImg: require('@/static/tab_my_active.png'),
						text: '我的',
						path: '/pages/my'
					}
				],
				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: 172rpx;
		background: #FFFFFF;
		display: flex;
		position: fixed;
		left: 0;
		bottom: 0;
		z-index: 999;
		padding-top: 18rpx;
		box-sizing: border-box;
		box-shadow: 0rpx -2rpx 8rpx 0rpx rgba(0,0,0,0.06);

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

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

			text {
				margin-top: 12rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 22rpx;
				color: #808080;
				line-height: 22rpx;
				text-align: center;
				&.active{
					font-weight: bold;
					color: #761E6A;
				}
			}
		}
	}
</style>