<template>
	<view class="histyRecords">
		<scroll-view class="tab-bar" scroll-x="true" scroll-with-animation>
			<view class="tab-container">
				<view v-for="(tab, index) in tabs" :key="index"
					:class="['tab-item', activeTab === index ? 'active' : '']" @click="switchTab(tab,index)">
					{{tab.name}}
				</view>
			</view>
		</scroll-view>
		<scroll-view class="content-list" scroll-y="true">
			<view class="record-item" v-for="item in recodesInfo" :key="item.index">
				<view class="record-details">
					<text class="detail-time">开机时间</text>
					<text class="detail-line">2026.08.29 21:13:58</text>
					<text class="detail-line">关机时间</text>
					<text class="detail-time">2025.06.30 00:45:20</text>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabs: [{
						name: '开机',
					},
					{
						name: '报警',
					},
				],
				activeTab: 0,
				recodesInfo: [{}]
			}
		},
		methods: {
			// tab切换页
			switchTab(tab, index) {
				this.activeTab = index
			},
		}
	}
</script>

<style>
	.histyRecords {
		width: 100%;
		height: 100vh;
		background: rgba(18, 18, 18, 1);
		padding: 30rpx;
	}

	.tab-bar {
		width: 100%;
		color: rgb(255, 255, 255);
		white-space: nowrap;
		overflow: hidden;
		position: relative;
	}

	.tab-container {
		display: flex;
		cursor: pointer;
		margin-bottom: 40rpx;
		justify-content: space-between;
	}

	.tab-item {
		font-size: 28rpx;
		padding: 0 30rpx;
		text-align: center;
	}

	.active {
		color: rgba(187, 230, 0, 1);
		border-bottom: 6rpx solid rgba(187, 230, 0, 1);
		height: 60rpx;
	}

	.content-list {
		height: calc(100vh - 300rpx);
	}

	.record-item {
		display: flex;
		margin-bottom: 20rpx;
		background: rgba(26, 26, 26, 1);
		border-radius: 18rpx;
		padding: 20rpx;
	}

	.record-details {
		flex: 1;
	}

	.detail-line {
		display: block;
		font-size: 28rpx;
		margin-bottom: 10rpx;
		color: rgba(255, 255, 255, 0.87);
		font-size: 24rpx;
		line-height: 40rpx;
	}

	.detail-time {
		color: rgba(255, 255, 255, 0.6);
		font-size: 24rpx;
	}

	.time-display {
		position: absolute;
		top: 30rpx;
		right: 30rpx;
		font-size: 28rpx;
		color: #BBE600;
	}
</style>