<template>
	<view>
		<cu-custom><block slot="content">导航栏</block></cu-custom>
		<view  scroll-x class="top-nav">
			<view class="flex text-center">
				<view class="cu-item flex-sub" :current= 'currentTab'  v-for="(item,index) in 4" :key="index" @tap="tabSelect" :data-id="index">
					Tab{{index}}
				</view>
			</view>
			<view class="flex text-center top-nav2" v-show="currentTab === 0">
				<view class="cu-item flex-sub" v-for="(item,index) in tab0data" :key="item.id" @tap="tabSelect" :data-id="item.id">
					{{item.name}}
				</view>
			</view>
		</view>
		<view class="main">
			<view class="card" v-for="(item,index) in 4" :key="index">
				<H1>Tab{{index}}</H1>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				TabCur: 0,
				scrollLeft: 0,
				currentTab:0,
				tab0data:[
					{name:"测风装置",id:0},
					{name:"对射测风",id:1},
					{name:"单点测风",id:2},
					{name:"九点测风",id:3},
				]
			};
		},
		methods: {
			tabSelect(e) {
				this.currentTab = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
			}
		}
	}
</script>

<style>
	.top-nav{
		height: 100rpx;
		line-height: 100rpx;
		background-color: #2aa9f3;
		color: #daaaa;
	}
	.top-nav2{
		background-color:#ffffff
	}
	.main{
		margin-top: 100rpx;
		display: flex;
		flex-direction: column;
	}
	.card{
		background-color: #ffffff;
		margin: auto;
		margin-top: 20rpx;
		width: 90%;
		height: 280rpx;
		border:1rpx solid #000000;
		border-radius: 20rpx;
	}
</style>
