<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>
	import SubSidebar from './subSidebar'

export default {
  name: 'AppMain',
  components:{
  	SubSidebar
  },
  props:["currRouter"],
  computed: {
    cachedViews() {
      return this.$store.state.tagsView.cachedViews
    },
    key() {
      return this.$route.path
    }
  }
}
</script>

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

.app-main::-webkit-scrollbar {
		width: 10px;
	}

	.app-main::-webkit-scrollbar {
		width: 10px;
		height: 10px;
	}

	.app-main::-webkit-scrollbar-track {
		background: rgba(239, 239, 239, 0.2);
		border-radius: 2px;
	}

	.app-main::-webkit-scrollbar-thumb {
		background: rgba(191, 191, 191, 0.5);
		border-radius: 10px;
	}

	.app-main:-webkit-scrollbar-thumb:hover {
		background: rgba(191, 191, 191, 0.7);
	}

	.app-main::-webkit-scrollbar-corner {
		background: #ae8977;
	}

.left{
    /*height: 100vh;*/
    width: auto;
}

.fixed-header+.app-main {
  padding-top: 50px;
}

.hasTagsView {
  .app-main {
    /* 84 = navbar + tags-view = 50 + 34 */
    height: calc(100vh - 110px);
    overflow-y: hidden;
    margin-top: 10px;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(100,100,100,.2);
    padding: 10px;
    background-color: #fff;
  }

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

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