<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: 'https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/fe3e8f63-56a0-4ae8-a78b-4431cf81423a.png',
						activeImg: 'https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/8184a900-ba91-47ef-a619-641eccf0b3d8.png',
						text: '首页',
						path: '/pages/home'
					},
					{
						inactiveImg: 'https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/33cec4dd-3e33-4b5f-a230-4603075a02ec.png',
						activeImg: 'https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/99ea667e-7686-42f3-841a-cfa8b55a7afb.png',
						text: '角色',
						path: '/pages/role'
					},
					{
						inactiveImg: 'https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/6a241df7-1e66-4f88-a7da-8c5457088c06.png',
						activeImg: 'https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/03/096008f7-442e-41e2-91b6-c519ee27cad6.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% / 3);
			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: #7C8592;
				line-height: 22rpx;
				text-align: center;
				&.active{
					font-weight: bold;
					color: #111111;
				}
			}
		}
	}
</style>