<template>
  <section class="app-main">
    <!-- 过渡效果 -->
    <transition
      name="fade-transform"
      mode="out-in"
    >
      <!-- 切换路由展示的页面 -->
      <router-view :key="key" />
    </transition>
  </section>
</template>

<script>
export default {
  name: "AppMain",
  computed: {
    key() {
      return this.$route.path;
    },
  },
};
</script>

<style scoped>
.app-main {
  /*50 = navbar  */
  min-height: calc(100vh - 50px);
  width: 100%;
  position: relative;
  overflow: hidden;
}
.fixed-header + .app-main {
  padding-top: 50px;
}
</style>

<style lang="scss">
// 修复el-dialog打开时样式的bug
.el-popup-parent--hidden {
  .fixed-header {
    padding-right: 15px;
  }
}
</style>
