<template>
	  <view class="menu_wrapper">
	    <view class="menu_content">
	      <view v-for="item in menuLists" :key="item.link" class="tabbar_item" :class="{'active':item.link == currentPage}" @click="navTo(item)">
	        <view class="pic">
				
				<image v-if="item.link == currentPage" :src="'/static/tabbar/' + item.selectedIconPath + '.png'" mode="widthFix"></image>
				<image v-else :src="'/static/tabbar/' + item.iconPath + '.png'" mode="widthFix"></image>
	        </view>
	        <view class="name">{{item.name}}</view>
	      </view>
	    </view>
	  </view>
</template>

<script>
	export default {
		props: ['currentPage'],
		name:"tabBar",
		data() {
			return {
				menuLists: [
				    {key:1,name:'首页',iconPath:'home',selectedIconPath:'home_active',link:'index'},
				    {key:2,name:'SFP智能财策',iconPath:'sfp',selectedIconPath:'sfp_active',link:'product'},
				    {key:3,name:'CFFP认证',iconPath:'cffp',selectedIconPath:'cffp_active',link:'courselist'},
				    {key:4,name:'我的',iconPath:'my',selectedIconPath:'my_active',link:'personalCenter'},
				]
			}
		},
		methods: {
			navTo(item) {
				console.log(item ,1154)
				if (item.link != this.currentPage) {
					// uni.navigateTo({
					// 	url:`/pages/${item.link}/${item.link}`
					// })
					uni.reLaunch({
						url:`/pages/${item.link}/${item.link}`
					})
				}
			}	
		},
		mounted() {
			console.log(this.currentPage,1114)
		}
	}
</script>

<style lang="scss" scoped>
	.menu_wrapper{
		position: fixed;
		bottom: 0;
		left: 50%;
		width: 100%;
		height: 70rpx;
		border-top: 2rpx solid #f5f5f5;
		background: #fff;
		color: #333;
		font-size: 24rpx;
		padding-bottom: 80rpx;
		transform: translateX(-50%);
		.menu_content{
			display: flex;
			align-items: center;
			justify-content: space-around;
			.pic{
				width: 70rpx;
				margin: 0 auto;
			}
			.name{
				text-align: center;
			}
		}
	}
	
</style>
