<template>
  <div class="cl-hy">
    <div class="menus">
      <Menus :activeI="0" @changeIndex="changeIndex" :menus="menus"/>
    </div>
    <div class="content">
       <Gindex v-if="index === 0"/>
      <Report v-else-if="index === 1"/>
      <Ganalyse v-else-if="index === 2"/>
      <History v-else-if="index === 3"/>
    </div>
  </div>
</template>

<script>
import Menus from "@/components/Menus.vue";
import Gindex from "@/components/Gindex.vue";
import Report from "@/components/Report.vue";
import Ganalyse from "@/components/Ganalyse.vue";
import History from "@/components/History.vue";
import { onMounted, reactive, ref, toRefs, nextTick } from "vue";
export default {
  name: 'weather',
  components: {
    Menus,
    Gindex,
    Report,
    Ganalyse,
    History
  },
  setup(props, ctx) {
    const state = reactive({
      index: 0,
      menus:[
        {
          name: '首页',
        },
        {
          name: '检测指标',
        },
        {
          name: '数据分析',
        },
        {
          name: '历史数据',
        }
      ],
    })
    const changeIndex = (index) => {
      state.index = index;
    }
    return {
      ...toRefs(state),
      changeIndex
    }
  }
}
</script>
<style lang="scss" scoped>
.mt10 {
    margin-top: 10px;
  }
  .cl-hy {
    width: 100%;
    height:100%;
    display: flex;
    justify-content: space-between;
    // border: 1px solid red;
      .menus {
        width: 4%;
        height: 700px;
        // border: 1px solid red;
      }
      .content {
        width: 96%;
        height:100%;
        // border: 1px solid red;
      }
    
    
  }
</style>