needAir.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <div style="position: absolute; width: 100%; height: 100%">
  3. <a-spin class="loading-box" size="large" :spinning="loading" tip="正在加载,请稍等。。。" />
  4. </div>
  5. <div id="micro-need-air"></div>
  6. </template>
  7. <script lang="ts">
  8. import { onMounted, onBeforeUnmount, defineComponent, ref } from 'vue';
  9. import { unmountMicroApps, mountMicroApp } from '/@/qiankun';
  10. import { resetMicroContentWH } from '/@/utils/domUtils';
  11. export default defineComponent({
  12. name: 'NeedAir',
  13. setup() {
  14. const loading = ref(true);
  15. onMounted(() => {
  16. mountMicroApp('/micro-need-air');
  17. resetMicroContentWH('micro-need-air', () => {
  18. loading.value = false;
  19. });
  20. });
  21. // onBeforeUnmount(() => {
  22. // unmountMicroApps(['/micro-need-air']);
  23. // });
  24. return { loading };
  25. },
  26. });
  27. </script>
  28. <style lang="less" scoped>
  29. .loading-box {
  30. position: fixed;
  31. display: flex;
  32. align-items: center;
  33. justify-content: center;
  34. width: 100%;
  35. height: 100%;
  36. }
  37. #micro-need-air {
  38. width: 100%;
  39. height: 100%;
  40. }
  41. </style>