<template>
	<view class="pageBgImg">
		<topNavbar title="找考场"></topNavbar>
		<view class="pad">
			<view class="search">
				<searchRow placeholder="搜索考场名称"/>
			</view>
			<view class="navBox">
				<view class="nav" v-for="(item,index) in navList" :key="index" :class="{active: currentNav==item.id}" @click="changeNav(item)">{{ item.text }}</view>
			</view>
			<view class="card">
				<examineItem></examineItem>
			</view>
		</view>
	</view>
</template>

<script>
	import examineItem from '../comp/examineItem.vue'
	export default {
		components: {
			examineItem
		},
		data() {
			return {
				navList: [
					{text: '全部', id: 0},
					{text: '理论', id: 1},
					{text: '科目二', id: 2},
					{text: '科目三', id: 3},
				],
				currentNav: 0
			}
		},
		methods: {
			changeNav(item) {
				this.currentNav = item.id
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pageBgImg {
		min-height: 100vh;
	}
	.navBox {
		display: flex;
		justify-content: space-between;
		padding: 24rpx 42rpx 36rpx 42rpx;
		.nav {
			display: flex;
			font-size: 28rpx;
			color: #fff;
			&.active {
				position: relative;
				&::before {
					content: '';
					position: absolute;
					bottom: -14rpx;
					left: 50%;
					transform: translateX(-50%);
					width: 50rpx;
					height: 4rpx;
					background-color: #fff;
					border-radius: 0 0 2rpx 2rpx;
				}
			}
		}
	}
	.card {
		padding: 32rpx 24rpx 28rpx 24rpx;
		margin-bottom: 20rpx;
	}
</style>