<!--
 * @Author: your name
 * @Date: 2021-10-14 17:17:53
 * @LastEditTime: 2021-10-18 17:03:51
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \Foshan4A\src\layout\components\AppMain.vue
-->
<template>
  <section class="app-main">
    <div class="app-main-content">
      <transition
        name="fade-transform"
        mode="out-in"
      >
        <keep-alive
          v-if="$route.meta && $route.meta.keepAlive"
          :max="6"
        >
          <router-view :key="key" />
        </keep-alive>
        <router-view
          v-else
          :key="key"
        />
      </transition>
    </div>
  </section>
</template>

<script>
export default {
  name: 'AppMain',
  computed: {
    key() {
      return Object.keys(this.$route.query).reduce((string, currentKey, index) => {
        if (currentKey !== 'fastFilter') {
          string += `${index ? '&' : '?'}${currentKey}=${this.$route.query[currentKey]}`
        }
        return string
      }, this.$route.path)
    }
  }
}
</script>

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

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