<template>
  <Layout class="layout">
    <Header>
      <master-header-open>
        <template v-slot:left>
          <span class="btn-collaspe" @click="handleToggle">
            <Icon custom="iconfont icon38" size="20"></Icon>
          </span>
        </template>
        <template v-slot:right>

        </template>
      </master-header-open>
    </Header>
    <div class="base-side">
      <div class="mask" :class="{visible:isShow}" @click="isShow=false">
      </div>
      <div class="side-wrapper" :class="{visible:isShow}">
        <master-sider-open />
      </div>
    </div>
    <Content class="content">
      <component :is="component"></component>
    </Content>
  </Layout>
</template>

<script>
export default {
  data() {
    return {
      isShow: false,
    };
  },
  created() {},
  methods: {
    handleToggle() {
      this.isShow = !this.isShow;
    },
  },
  asyncComputed: {
    component: function () {
      console.log(this.$route);
      return utils.getComponent(this.$route.path);
    },
  },
};
</script>

<style scoped lang="less">
@import "~@/assets/less/variable";
.ivu-layout {
  height: 100%;
  background: #fff;
}
.layout {
  min-width: 1240px;
  overflow: hidden;
}
.content {
  height: calc(100% - 61px);
  overflow-y: auto;
}
.ivu-layout-header {
  width: 100%;
  background: #fff;
  border-bottom: 1px solid @border-color;
  box-sizing: border-box;
}
.base-side {
  position: fixed;
  top: 60px;
  bottom: 0;
  left: 0;
  z-index: 998;
  background-color: #fff;
  width: 0;
}
.mask {
  position: absolute;
  visibility: hidden;
  opacity: 0;
  background-color: rgba(0, 0, 0, 0.45);
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  -webkit-transition: all 0.3s cubic-bezier(0, 0, 0.2, 1);
  transition: all 0.3s cubic-bezier(0, 0, 0.2, 1);
}
.mask.visible {
  visibility: visible;
  opacity: 1;
}
.side-wrapper {
  width: 0;
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1001;
  background-color: #fff;
  overflow: hidden;
  -webkit-transition: all 0.3s cubic-bezier(0, 0, 0.2, 1);
  transition: all 0.3s cubic-bezier(0, 0, 0.2, 1);
}
.side-wrapper.visible {
  width: 240px;
}
.btn-collaspe {
  display: inline-flex;
  width: 90px;
  height: 60px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: @primary-color;
  color: #fff !important;
}
</style>