<template>
  <div class="repairing">
    <app-header></app-header>
    <el-container>
      <el-aside style="width:max-width:200px">
        <left-side></left-side>
      </el-aside>
      <el-main class="repairingMain">
        <keep-alive :include="tagsList">
          <router-view></router-view>
        </keep-alive>
      </el-main>
    </el-container>
  </div>
</template>

<script>
import header from "../header/header.vue";
import leftside from "../header/leftside.vue";
import bus from "./bus";
export default {
  components: {
    appHeader: header,
    leftSide: leftside
  },
  name: "project",
  data() {
    return {
      tagsList: [],
      collapse: false
    };
  },
  created() {
    bus.$on("collapse", msg => {
      this.collapse = msg;
    });

    // 只有在标签页列表里的页面才使用keep-alive，即关闭标签之后就不保存到内存中了。
    bus.$on("tags", msg => {
      let arr = [];
      for (let i = 0, len = msg.length; i < len; i++) {
        msg[i].name && arr.push(msg[i].name);
      }
      this.tagsList = arr;
    });
  },
  mounted() {},
  methods: {}
};
</script>