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

      onBeforeUnmount(async () => {
        await unmountMicroApps(['micro-vent-2dModal']);
      });

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