<template>
	<view class="content">
		<view class="items" v-for="(item,index) in tabList" :key="item.id" @click="tabsClick(index,item.tagType)">
			<view class="flex-col">
				<span :class="currentIndex == index ? 'active' : 'default'">{{item.title}}</span>
				<span class="line-through" v-show="currentIndex == index"></span>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "tabs",
		props: [],
		data() {
			return {
				currentIndex: 0,
				tabList: [
					// 	{
					// 	name: '聊天室',
					// 	id:"chat"
					// }, {
					// 	name: '课件',
					// 	id:"courseware"
					// }, {
					// 	name: '直播详情',
					// 	id:"sinatv"
					// },
				]
			};
		},
		mounted() {
			this.$api.getroomconfigtags().then(res => {
				console.log(res, 123)
				if (res.data.code == 200) {
					this.tabList = res.data.data
				}
			})
		},
		methods: {
			tabsClick(index,type) {
				this.currentIndex = index
				let id = "";
				switch (type) {
					case 1:
						id = "chat";
						break;
					case 6:
						id = "sinatv"
						break;
					default:
						id = "courseware"
						break;
				}
				this.$emit("skipComponent", {id:id,type:type})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		display: flex;
		height: 80rpx;
		font-size: 32rpx;
		box-shadow: 0 2rpx 10rpx #dadada;
		;

		.items {
			flex: 1;
			text-align: center;
			display: flex;
			align-items: center;
			justify-content: center;

			.line-through {
				width: 40rpx;
				height: 6rpx;
				background-color: #1374E7;
				margin-top: 6rpx;
			}
		}
	}

	.flex-col {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.active {
		color: #1374E7
	}

	.default {
		color: #999999
	}
</style>
