<template>
  <section class="app-main">
    <transition name="fade-transform" mode="out-in">
      <router-view :key="key" />
    </transition>
  </section>
</template>

<script>
export default {
  name: 'AppMain',
  props: ['value'],
  computed: {
    key() {
      return this.$route.path
    }
  },
  mounted(){
    this.importCss()
  },
  methods:{
    async importCss() {
      let loadStyle
      // console.log(4)
      // console.log(this.styleSwitch)
      if (sessionStorage.getItem('styleSwitch')==='blue') {
        // this.$store.commit('UPDATE_STYLE', 'blue')
        // sessionStorage.setItem('styleSwitch','blue')
        loadStyle = await import('../../styles/blue.scss')

      } else {
        // this.$store.commit('UPDATE_STYLE', 'white')
        // sessionStorage.setItem('styleSwitch','white')
        loadStyle = await import('../../styles/blue.scss')
      }
      return loadStyle
    }
  }
}
</script>

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

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

</style>
