<template>
	<u-tabbar v-model="current" :before-switch="beforeSwitch" :list="list" @change="change" active-color="#007aff"
		:height="Headers"></u-tabbar>
</template>
<script>
	import config from "@/common/config";
	export default {
		name: "myTabbar",
		options: {
			styleIsolation: "shared"
		},
		data() {
			return {
				list: [{
						pagePath: "/pages/index/index",
						iconPath: require("@/static/modIcon/home-1.png"),
						selectedIconPath: require("@/static/modIcon/home.png"),
						text: "首页",
					},
					{
						pagePath: "/pages/course/index",
						iconPath: require("@/static/modIcon/choose-1.png"),
						selectedIconPath: require("@/static/modIcon/choose.png"),
						text: "选购",
					},
					{
						pagePath: "/pages/learn/index",
						iconPath: require("@/static/modIcon/study-1.png"),
						selectedIconPath: require("@/static/modIcon/study.png"),
						text: "学习",
					},
					{
						pagePath: "/pages/questionBank/index",
						iconPath: require("@/static/modIcon/practice-1.png"),
						selectedIconPath: require("@/static/modIcon/practice.png"),
						text: "练习",
					},
					// {
					//   pagePath: "/pages/information/index",
					//   iconPath: config.BASE_IMG_URL + "/web/icon/nav4.png",
					//   selectedIconPath: config.BASE_IMG_URL + "/web/icon/nav4_on.png",
					//   text: "资料",
					// },
					{
						pagePath: "/pages/wd/index",
						iconPath: require("@/static/modIcon/my-1.png"),
						selectedIconPath: require("@/static/modIcon/my.png"),
						text: "我的",
					},
				],
				current: 0,
				Headers: "100rpx"
			};
		},

		mounted() {
		},
		onShow() {},
		methods: {
			beforeSwitch(index) {
				return true; // 或者根据逻辑返回false
			},
			change(index) {
				this.current = index;
				// if (index === 4) {
				//   this.toInformation();
				// }
			},
			toInformation() {
				uni.reLaunch({
					url: "/pages/information/index",
				});
			},
		},
	};
</script>

<style lang="scss">
	.u-tabbar {
		::v-deep &__content {
			z-index: 10000 !important;
		}
	}
</style>