<template>
  <div class="inspection home">
    <view-header>
      <div class="home-navs" slot="navTop">
        <ul>
          <li
            :class="{ act: curNav.name === nav.name }"
            v-for="(nav, index) in navs"
            :key="index"
            @click="switchNav(nav)"
          >
            <i
              :class="[
                'icon',
                curNav.name === nav.name ? `${nav.icon}-act` : nav.icon
              ]"
              v-if="nav.icon"
            ></i>
            <span class="nav-item-cont">{{ nav.title }}</span>
          </li>
        </ul>
      </div>
    </view-header>

    <div class="home-body">
      <div class="home-main">
        <router-view />
      </div>
    </div>
  </div>
</template>

<script>
import { inspection } from "@/constants/authority";
import menuMixins from "@/components/homeMenuMixins";

export default {
  name: "inspection",
  mixins: [menuMixins],
  data() {
    return { navs: inspection, curNav: {} };
  },
  watch: {
    $route: {
      handler(val) {
        this.actCurNav(val);
      }
    }
  },
  mounted() {
    this.actCurNav(this.$route);
  }
};
</script>
