<template>
  <div class="HomePage">
    <Header />
    <div class="content">
      <div class="navs">
        <Menu />
      </div>
      <div class="table-box">
        <div class="search">
          <div class="ipt-box">
            <el-input
              placeholder="请输入应用名称，企业名称进行查询"
              v-model="searchKeyword"
            ></el-input>
            <el-button
              type="primary"
              @click="toSearchInfoList"
              style="height: 32px"
              >搜索</el-button
            >
          </div>
          <infoForm type="add" @reInit="toSearchInfoList">
            <el-button type="success">新增</el-button>
          </infoForm>
          <el-button type="text" style="color: #fff; margin-left: 10px"
            >更多</el-button
          >
        </div>
        <div class="info">
          <router-view ref="info"></router-view>
        </div>
      </div>
      <div class="news">
        <News />
      </div>
    </div>
  </div>
</template>

<script>
import Header from "./components/Header";
import News from "./components/news/index.vue";
import Menu from "./components/Menu.vue";
export default {
  name: "HomePage",
  components: {
    Header,
    News,
    Menu,
  },
  data() {
    return {
      searchKeyword: "",
    };
  },
  created() {
  },
  mounted() {
    console.log(this.$route.path, 'this.$router');
    
  },
  watch: {
    // $route: {
    //   handler: function (route) {
    //     this.navList = this.$router.options.routes;
    //   },
    //   immediate: true,
    // },
  },
  computed: {},
  methods: {
    toSearchInfoList() {
      if(this.$route.path == '/baseSystemInfo/index.vue') {
        this.$refs.info.search();
      } else {
        this.$router.push({
          path: "/baseSystemInfo/index.vue",
          query: { keyword: this.searchKeyword },
        });
      }
    },
  },
};
</script>

<style scoped lang="scss">
@import "./homePage.scss";
</style>
