<template>
	<view class="tabbar">
		<view @click="switchTab(0)" class="tabbar-item">
			<image class="tabbar-icon" :src="actived===0?tabbarList[0].selectedIconPath:tabbarList[0].iconPath"
				mode="aspectFit"></image>
			<text class="noselect-text">{{tabbarList[0].text}}</text>
		</view>
		<view @click="switchTab(1)" class="tabbar-item">
			<view class="tabbar-item1">
				<image class="tabbar-icon1" :src="tabbarList[1].iconPath" mode="aspectFit"></image>
			</view>
		</view>
		<view @click="switchTab(2)" class="tabbar-item">
			<image class="tabbar-icon" :src="actived===2?tabbarList[2].selectedIconPath:tabbarList[2].iconPath"
				mode="aspectFit"></image>
			<text class="noselect-text">{{tabbarList[2].text}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'MyTabBar',
		props: ['actived'],
		data() {
			return {
				tabbarList: [{
						iconPath: '../static/tabbar/home.png',
						selectedIconPath: "../static/tabbar/selectedHome.png",
						text: '首页'
					},
					{
						iconPath: '../static/tabbar/one.png',
						text: ''
					},
					{
						iconPath: '../static/tabbar/my.png',
						selectedIconPath: "../static/tabbar/selectedMy.png",
						text: '我的'
					},
				]
			}
		},
		methods: {
			switchTab(index) {
				this.$emit('tab-switch', index);
			},
		}
	}
</script>

<style scoped>
	.tabbar {
		display: flex;
		/* border-top: 1px solid #ccc; */
		background-color: #fff;
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		z-index: 99;
		padding-top:8rpx ;
		height: 120rpx;
	}

	.tabbar-item {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		height: 50px;
		position: relative;
	}

	.tabbar-icon {
		width: 48rpx;
		height: 46rpx;
		margin-bottom: 10rpx;
	}

.tabbar-text-actived{
	font-size: 12rpx;
	color: #feebd7;
}
	.tabbar-icon1 {
		display: inline-block;
		width: 120rpx;
		height: 120rpx;
		position: fixed;
		bottom: 36rpx;
		left: 320rpx
	}
	.noselect-text{
		color:#333
	}
</style>