<template>
	<view class="container">
		<view class="content" :class="tabValue">
			<course-home v-if="tabValue === 'courseHome'"></course-home>
			<course-mine v-if="tabValue === 'courseMine'"></course-mine>
		</view>
		<view class="tabbar-block"></view>
		<view class="tabbar">
			<view  class="tab-item" :class="{ active: tabValue === 'courseHome' }" @click="selectTab('courseHome')">
				<image src="/static/tabbar-icon/home-fill.png" v-if="tabValue === 'courseHome'"></image>
				<image src="/static/tabbar-icon/home.png" v-else></image>
				<text>放映厅</text>
			</view>-
			<view  class="tab-item" :class="{ active: tabValue === 'courseMine' }" @click="selectTab('courseMine')">
				<image src="/static/tabbar-icon/user-s.png" v-if="tabValue === 'courseMine'"></image>
				<image src="/static/tabbar-icon/user-line.png" v-else></image>
				<text>我的</text>
			</view>
		</view>
	</view>
</template>

<script>
	import courseHome from './component/courseHome/courseHome.vue';
	import courseMine from './component/courseMine/courseMine.vue';

	export default {
		data() {
			return {
				tabValue: 'courseHome', // 默认选中的 Tab
			};
		},
		components: {
			courseHome,
			courseMine,
		},
		methods: {
			selectTab(value) {
				this.tabValue = value; // 设置当前选中的 Tab
			},
		},
	};
</script>

<style scoped lang="scss">
	.container {
		display: flex;
		flex-direction: column;
		height: 100vh;
	}

	.content {
		flex: 1;
		/* 内容区填充剩余空间 */
		padding: 0 30rpx;

		/* 内边距 */
	}
	.courseHome {
		background-color: #fff;
	}
	.courseMine {
		background-color: #f7f7f7;
	}
	.tabbar-block {
		flex: 0 0 auto;
		height: 150rpx;
		padding-bottom: env(safe-area-inset-bottom, 0);
	}
	.tabbar {
		-webkit-tap-highlight-color: rgba(0,0,0,0);
		position: fixed;
		width: 100vw;
		// height: 100rpx;
		bottom: 0;
		display: flex;
		justify-content: space-around;
		/* 平分 TabBar 各项 */
		background-color: #fff;
		/* TabBar 背景色 */
		padding-bottom: env(safe-area-inset-bottom, 0);
		/* 避免与底部黑条重叠 */

		/* 仅在上方添加阴影 */
		box-shadow: 5px -1px 0px rgba(0, 0, 0, 0.1);
		/* 上边阴影效果 */
		height: 150rpx;
		align-items: center;
		border-top: none;
		/* 去掉上边的边框，如果之前有的话 */
		border-bottom: none;
		/* 去掉下边的边框 */
	}
	.tab-item {

		// padding: 15rpx 0;
		flex: 1;
		/* 每个 TabBar 项均分 */
		text-align: center;
		/* 内容居中 */
		cursor: pointer;
		/* 鼠标指针样式 */
		display: flex;
		/* 激活状态下加粗显示 */
		flex-direction: column;
		align-items: center;
		font-size: 20rpx;

		image {
			width: 50rpx;
			height: 50rpx;
		}
	}

	.tab-item.active {
		color: #0069f6;
		/* 激活状态下的文本颜色 */

	}
</style>
