<!--
 * @Author: gtz
 * @Date: 2022-04-11 09:56:17
 * @LastEditors: gtz
 * @LastEditTime: 2022-04-11 16:41:31
 * @Description: file content
 * @FilePath: \mt-bus-fe\src\layout\components\AppMain.vue
-->
<template>
  <section class="app-main">
    <transition name="fade-transform" mode="out-in">
      <keep-alive :include="cachedViews">
        <router-view :key="key" />
      </keep-alive>
    </transition>
  </section>
</template>

<script>
export default {
  name: 'AppMain',
  computed: {
    cachedViews() {
      return this.$store.state.tagsView.cachedViews
    },
    key() {
      return this.$route.path
    }
  }
}
</script>

<style lang="scss" scoped>
.app-main {
  /* 64= navbar  64  */
  min-height: calc(100vh - 64px);
  width: 100%;
  position: relative;
  overflow: hidden;
}

.fixed-header+.app-main {
  padding-top: 64px;
  // padding-bottom: 64px;
}

.hasTagsView {
  .app-main {
    /* 84 = navbar + tags-view = 64 + 34 */
    min-height: calc(100vh - 31px);
  }

  .fixed-header+.app-main {
    padding-top: 96px;
  }
}
</style>

<style lang="scss">
// fix css style bug in open el-dialog
.el-popup-parent--hidden {
  .fixed-header {
    padding-right: 15px;
  }
}
</style>
