<template>
	<view class="wrap">
		<uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
			@clickLeft="toBack">
			<view class="nav-title">
				<text>{{title}}</text>
			</view>
		</uni-nav-bar>
		<view class="container">
			<!-- 头部按钮 end -->
			<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text"
				activeColor="#585b61"></uni-segmented-control>
			<view class="content">
				<view v-show="current === 0">
					<rturaindata></rturaindata>
				</view>
				<view v-show="current === 1">
					<rturiverdata></rturiverdata>
				</view>
				<view v-show="current === 2">
					<rtugrounddata></rtugrounddata>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import http from '@/http/api.js';
	import rtugrounddata from '@/pages/realdata/rtugrounddata.vue'
	import rturaindata from '@/pages/realdata/rturaindata.vue'
	import rturiverdata from '@/pages/realdata/rturiverdata.vue'

	export default {
		components: {
			rtugrounddata,
			rturaindata,
			rturiverdata,
		},
		data() {
			return {
				title: '实时数据',
				navButton: [],
				items: ['雨情数据', '水情数据', '墒情数据'],
				current: 0,
			};
		},
		onLoad() {
			const navBtnlist = [{
					name: '雨情数据',
					img: '/static/images/home/statistics.png',
					url: '/pages/rtu-manage/rturaindata'
				},
				{
					name: '水情数据',
					img: '/static/images/home/statistics.png',
					url: '/pages/rtu-manage/rturiverdata'
				},
				{
					name: '墒情数据',
					img: '/static/images/manage/statistics.png',
					url: '/pages/rtu-manage/rtugrounddata'
				}
			];
			this.navButton = navBtnlist;
		},
		onShow() {

		},
		methods: {
			onClickItem(e) {
				if (this.current != e.currentIndex) {
					this.current = e.currentIndex;
				}
			},
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
		}
	};
</script>

<style lang="scss">

</style>
