<template>
  <div id="Home">
    <el-container class="main">
      <el-header>
        <v-head @refresh="toRefresh"></v-head>
      </el-header>
      <el-container>
        <el-aside width="200px">
          <v-sidebar></v-sidebar>
        </el-aside>
        <el-container>
          <el-main>
            <v-tags></v-tags>
            <breadcrumb></breadcrumb>
            <router-view :style="routerInfo" :key="viewKey"></router-view>
          </el-main>
        </el-container>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'Home',
  props: {},
  components: {
    vHead: () => import('./Header.vue'),
    vSidebar: () => import('./Sidebar.vue'),
    vTags: () => import('./Tags.vue'),
    breadcrumb: () => import('./breadcrumb.vue'),
  },
  data: function () {
    return {
      viewKey: new Date().getTime(),
      routerInfo: {
        background: '#ffffff',
        margin: '10px',
        padding: '10px',
        display: 'flex',
        'flex-direction': 'column',
        height: '83vh',
        'overflow-y': 'auto',
        border: '1px solid #ddd',
        'border-radius': '5px',
      },
    };
  },
  created() {},
  methods: {
    toRefresh() {
      this.viewKey = new Date().getTime();
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  height: 100vh;
  .el-header {
    padding: 0;
  }
  .el-main {
    padding: 0;
    background-color: #f0f0f0;
  }
}
</style>
