<template>
	<view class="tab_body">
		<view class="tab_item" :class="{active: clickIndex == index}" v-for="(item,index) in tabList" :key="index"
			@click="tabClick(item,index)">
			{{ item.dyh }}
		</view>
	</view>
</template>
<script>
	export default {
		name: 'tab',
		props: {
			tabList: {
				type: Array,
				default: []
			}
		},
		data() {
			return {
				clickIndex: 0
			}
		},
		methods: {
			show() {
				if (this.tabList.length > 0) {
					this.$emit('tab-click', this.tabList[this.clickIndex])
				}
			},
			tabClick(item, index) {
				this.clickIndex = index
				this.$emit('tab-click', item)
			},
			setFirst(index) {
				this.clickIndex = index
			}
		},
	}
</script>
<style lang="scss" scoped>
	.tab_body {
		display: flex;
		padding: 0 24rpx;
	}

	.tab_item {
		color: rgba(111, 124, 163, 1);
		font-size: 32rpx;
		height: 80rpx;
		padding: 0 -14rpx;
		margin: 0 38rpx 0 14rpx;
	}

	.active {
		color: rgba(4, 8, 20, 0.90) !important;
		font-weight: 600;
		border-bottom: 8rpx solid rgba(16, 109, 255, 1);
	}
</style>
