Home.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <el-container>
  3. <el-header style="padding:0;">
  4. <v-head></v-head>
  5. </el-header>
  6. <el-container>
  7. <el-aside width="200px">
  8. <v-sidebar></v-sidebar>
  9. </el-aside>
  10. <el-main>
  11. <div class="content-box" :class="{ 'content-collapse': collapse }">
  12. <v-tags></v-tags>
  13. <div class="content">
  14. <transition name="move" mode="out-in">
  15. <!-- <keep-alive :include="tagsList">
  16. <router-view></router-view>
  17. </keep-alive> -->
  18. <el-row>
  19. <el-col :span="24" class="main">
  20. <breadcrumb :breadcrumbTitle="this.$route.meta.title"></breadcrumb>
  21. <el-col :span="24" class="container">
  22. <!-- <transition name="fade"> -->
  23. <router-view></router-view>
  24. <!-- </transition> -->
  25. </el-col>
  26. </el-col>
  27. </el-row>
  28. </transition>
  29. <el-backtop target=".content"></el-backtop>
  30. </div>
  31. </div>
  32. </el-main>
  33. </el-container>
  34. </el-container>
  35. </template>
  36. <script>
  37. import breadcrumb from '@l/breadcrumb.vue';
  38. import vHead from './Header.vue';
  39. import vSidebar from './Sidebar.vue';
  40. import vTags from './Tags.vue';
  41. import bus from './bus';
  42. export default {
  43. data() {
  44. return {
  45. tagsList: [],
  46. collapse: false,
  47. };
  48. },
  49. components: {
  50. vHead,
  51. vSidebar,
  52. vTags,
  53. breadcrumb,
  54. },
  55. created() {
  56. bus.$on('collapse-content', msg => {
  57. this.collapse = msg;
  58. });
  59. // 只有在标签页列表里的页面才使用keep-alive,即关闭标签之后就不保存到内存中了。
  60. bus.$on('tags', msg => {
  61. let arr = [];
  62. for (let i = 0, len = msg.length; i < len; i++) {
  63. msg[i].name && arr.push(msg[i].name);
  64. }
  65. this.tagsList = arr;
  66. });
  67. },
  68. };
  69. </script>