<template>
  <div style="position: absolute; width: 100%; height: 100%">
    <a-spin class="loading-box" size="large" :spinning="loading" tip="正在加载，请稍等。。。" />
  </div>
  <div id="micro-need-air"></div>
</template>
<script lang="ts">
  import { onMounted, onBeforeUnmount, defineComponent, ref } from 'vue';
  import { unmountMicroApps, mountMicroApp } from '/@/qiankun';
  import { resetMicroContentWH } from '/@/utils/domUtils';
  export default defineComponent({
    name: 'NeedAir',
    setup() {
      const loading = ref(true);
      onMounted(() => {
        mountMicroApp('/micro-need-air');
        resetMicroContentWH('micro-need-air', () => {
          loading.value = false;
        });
      });

      // onBeforeUnmount(() => {
      //   unmountMicroApps(['/micro-need-air']);
      // });

      return { loading };
    },
  });
</script>
<style lang="less" scoped>
  .loading-box {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
  }
  #micro-need-air {
    width: 100%;
    height: 100%;
  }
</style>
