micro-app-page.vue 1019 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <micro-app-demo
  3. :baseroute="`#/${microAppConfig.name}`"
  4. :data="microAppConfig.data"
  5. :name="microAppConfig.name"
  6. :url="microAppConfig.path"
  7. @beforemount="appBeforemount"
  8. @mounted="appMounted"
  9. keep-alive
  10. ></micro-app-demo>
  11. </template>
  12. <script setup lang="ts">
  13. import { computed, getCurrentInstance, ref, nextTick } from "vue";
  14. const { proxy } = getCurrentInstance() as any;
  15. // 微服务设置
  16. const microAppConfig = computed(() => {
  17. const { Path, isMicroApp, MicroAppName, MicroAppPath } = proxy.$store.state.routeItem;
  18. return {
  19. is: isMicroApp,
  20. name: MicroAppName,
  21. path: MicroAppPath,
  22. data: {
  23. isPage: true,
  24. redirect: Path.replace(`/${MicroAppName}`, ""),
  25. },
  26. };
  27. });
  28. const emits = defineEmits(["update:loading"]);
  29. const appBeforemount = () => {
  30. emits("update:loading", true);
  31. };
  32. const appMounted = () => {
  33. emits("update:loading", false);
  34. };
  35. </script>
  36. <style lang="scss" scoped>
  37. micro-app {
  38. height: 100%;
  39. width: 100%;
  40. }
  41. </style>