//my-tabbar文件
<template>
	<view class="tabModel">
		<u-tabbar :value="currentTab" :fixed="true" :safeAreaInsetBottom='true' :border="false" activeColor="#d81e06"
			:placeholder="false" @change="changeTabIndex">
			<u-tabbar-item v-for="item in switchTabs" :key="item.name" :text="item.text">
				<image class="u-page__item__slot-icon" slot="active-icon" :src="item.iniconPath"></image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" :src="item.iconPath"></image>
			</u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				switchTabs: [{
						"pagePath": "/pages/index/index",
						"iconPath": "http://amy.yyinhong.cn/uploads/wximg/Home.png",
						"iniconPath": "http://amy.yyinhong.cn/uploads/wximg/inHome.png",
						"text": "首页",
						"name": "index"
					},
					{
						"pagePath": "/pages/product/product",
						"iconPath": "http://amy.yyinhong.cn/uploads/wximg/good.png",
						"iniconPath": "http://amy.yyinhong.cn/uploads/wximg/inGood.png",
						"text": "商品",
						"name": "product"
					},
					{
						"pagePath": "/pages/shoppingCart/shoppingCart",
						"iconPath": "http://amy.yyinhong.cn/uploads/wximg/shopCar.png",
						"iniconPath": "http://amy.yyinhong.cn/uploads/wximg/inShopCar.png",
						"text": "购物车",
						"name": "shoppingCart"
					},
					{
						"pagePath": "/pages/personalCenter/personalCenter",
						"iconPath": "http://amy.yyinhong.cn/uploads/wximg/mytab.png",
						"iniconPath": "http://amy.yyinhong.cn/uploads/wximg/inMy.png",
						"text": "我的",
						"name": "personalCenter"
					}
				],
				tabActive: null
			}
		},
		props: ['currentTab'],
		methods: {
			changeTabIndex(e) {
				this.tabActive = e;
				let pagePath = this.switchTabs[e].pagePath;
				setTimeout(() => {
					uni.switchTab({
						url: pagePath
					})
				}, 200)
			}
		}
	}
</script>
<style lang="scss" scoped>
	.u-page__item__slot-icon {
		width: 48rpx;
		height: 48rpx;
		margin: auto;
	}
</style>