<template>
	<view class="data_container">
		<!-- 头部模块 -->
		<u-sticky >
			<view class="nav-header">
				<view class="nav_box" :class="{active: currentData === 0}" @click="currentData = 0">总览</view>
				<view class="nav_box" :class="{active: currentData === 1}" @click="currentData = 1">收入明细</view>
			</view>
		</u-sticky>
		<!-- 内容模块 -->
		<view class="content">
			<!-- 数据总览 -->
			<DataPandect v-show="currentData === 0" />
			<!-- 数据明细 -->
			<DataDetail v-show="currentData === 1" />
		</view>
	</view>
</template>

<script>
import DataPandect from '@/components/data/dataPandect.vue'
import DataDetail from '@/components/data/dataDetail.vue'
export default {
	components: { DataPandect, DataDetail },
	data(){
		return {
			currentData: 0, // 切换数据
		}
	}
}
</script>

<style lang="scss" scoped>
.data_container {
	background-color: #F6F7FB;
	padding-bottom: 180rpx;
	min-height: 100vh;
	// 头部模块
	.nav-header{
		display: flex;
		align-items: center;
		justify-content: center;
		height: 80rpx;
		background-color: #fff;
		.nav_box{
			position: relative;
			flex: 1;
			height: 100%;
			color: #BBBBBB;
			font-size: 32rpx;
			text-align: center;
			line-height: 80rpx;
			&.active{
				font-weight: 500;
				color: #333;
				&::after{
					position: absolute;
					bottom: 0;
					left: 50%;
					transform: translateX(-50%);
					content: '';
					width: 40rpx;
					height: 8rpx;
					background-color: #FFA100;
					border-radius: 20rpx;
				}
			}
		}
	}
}
</style>