needAir.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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, unref } from 'vue';
  9. import { unmountMicroApps, mountMicroApp } from '/@/qiankun';
  10. import { resetMicroContentWH } from '/@/utils/domUtils';
  11. import { useRouter } from 'vue-router';
  12. export default defineComponent({
  13. name: 'NeedAir',
  14. setup() {
  15. const loading = ref(true);
  16. const { currentRoute } = useRouter();
  17. onMounted(() => {
  18. mountMicroApp(unref(currentRoute).fullPath);
  19. resetMicroContentWH('micro-need-air', () => {
  20. loading.value = false;
  21. });
  22. });
  23. onBeforeUnmount(() => {
  24. unmountMicroApps(currentRoute);
  25. });
  26. return { loading };
  27. },
  28. });
  29. </script>
  30. <style lang="less" scoped>
  31. .loading-box {
  32. position: fixed;
  33. display: flex;
  34. align-items: center;
  35. justify-content: center;
  36. width: 100%;
  37. height: 100%;
  38. }
  39. #micro-need-air {
  40. width: 100%;
  41. height: 100%;
  42. }
  43. </style>