<template>
  <div class="office" @click="_toogle">
    <div class="btn">
      <div class="icon" :style="{background: channelInfo && channelInfo.screenDirection === 'vertical' ? `url(${defaultIcon}) no-repeat center center` : ''}"></div>
    </div>
    <div class="title">文档</div>
    <div class="office-box" v-transfer-dom v-show="isShow">
      <keep-alive>
        <office-demo v-model="isShow" v-if="isShow"></office-demo>
      </keep-alive>
    </div>
  </div>
</template>
<script>
import { mapGetters } from 'vuex';
const officeDemo = resolve => require(['./officeDemo'], resolve);
export default {
  name: 'suspension-office',
  components: {
    officeDemo
  },
  data() {
    return {
      isShow: false,
      defaultIcon: require('./img/icon-office.png')
    };
  },
  computed: {
    ...mapGetters({
      channelConfig: 'channelConfig',
      channelInfo: 'channelInfo'
    })
  },
  methods: {
    _toogle() {
      this.isShow = !this.isShow;
    }
  }
};
</script>
<style lang="less" scoped>
.office {
  width: 0.8rem;
  height: 0.8rem;
  .btn {
    position: relative;
    padding: 0 0.1rem;
    width: 0.8rem;
    height: 0.6rem;
    background: var(--suspension-office-bg) no-repeat center center;
    background-size: contain;
    .icon {
      width: 100%;
      height: 100%;
      background: var(--suspension-office-icon) no-repeat center center;
      background-size: auto 50%;
    }
  }
  .title {
    margin-top: 0.04rem;
    line-height: 0.18rem;
    text-align: center;
    white-space: nowrap;
    font-size: 0.16rem;
  }
}
.office-box {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 1000;
  width: 100%;
}
</style>
