1
杨磊
2025-03-31 2a1f356bb2b37cb8b56eb1d8bc94bf4fe4639e0f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<template>
  <div class="homeLayoutBox">
    <div class="pageContentBox">
      <keep-alive v-if="keepAliveList.length > 0" :include="keepAliveList">
        <router-view />
      </keep-alive>
      <router-view v-else />
    </div>
  </div>
</template>
 
<script>
import { mapState } from "vuex";
export default {
 
  computed: {
    ...mapState(["userInfo", "keepAliveList"]),
  },
  watch: {
    $route(to, from) {
      if (to.meta.keepAlive && this.keepAliveList.indexOf(to.name) == -1) {
        this.$store.commit("addKeepAlive", to.name); 
      }
    },
  },
};
</script>
 
<style lang="less" scoped>
.homeLayoutBox {
  width: 100%;
  height: 100%;
  .pageContentBox {
    min-height: calc(100% - 525px);
  }
}
</style>