普兆健康管家后端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.9 KiB

3 months ago
  1. // /**
  2. // * qiankun配置
  3. // */
  4. // import { registerMicroApps, setDefaultMountApp, start, runAfterFirstMounted, addGlobalUncaughtErrorHandler } from 'qiankun';
  5. // import { apps } from './apps';
  6. // import { getProps, initGlState } from './state';
  7. //
  8. // /**
  9. // * 重构apps
  10. // */
  11. // function filterApps() {
  12. // apps.forEach((item) => {
  13. // //主应用需要传递给微应用的数据。
  14. // item.props = getProps();
  15. // //微应用触发的路由规则
  16. // // @ts-ignore
  17. // item.activeRule = genActiveRule('/' + item.activeRule);
  18. // });
  19. // return apps;
  20. // }
  21. //
  22. // /**
  23. // * 路由监听
  24. // * @param {*} routerPrefix 前缀
  25. // */
  26. // function genActiveRule(routerPrefix) {
  27. // return (location) => location.pathname.startsWith(routerPrefix);
  28. // }
  29. //
  30. // /**
  31. // * 微应用注册
  32. // */
  33. // function registerApps() {
  34. // const _apps = filterApps();
  35. // registerMicroApps(_apps, {
  36. // beforeLoad: [
  37. // // @ts-ignore
  38. // (loadApp) => {
  39. // console.log('before load', loadApp);
  40. // },
  41. // ],
  42. // beforeMount: [
  43. // // @ts-ignore
  44. // (mountApp) => {
  45. // console.log('before mount', mountApp);
  46. // },
  47. // ],
  48. // afterMount: [
  49. // // @ts-ignore
  50. // (mountApp) => {
  51. // console.log('before mount', mountApp);
  52. // },
  53. // ],
  54. // afterUnmount: [
  55. // // @ts-ignore
  56. // (unloadApp) => {
  57. // console.log('after unload', unloadApp);
  58. // },
  59. // ],
  60. // });
  61. // // 设置默认子应用,与 genActiveRule中的参数保持一致
  62. // // setDefaultMountApp();
  63. // // 第一个微应用 mount 后需要调用的方法,比如开启一些监控或者埋点脚本。
  64. // runAfterFirstMounted(() => console.log('开启监控'));
  65. // // 添加全局的未捕获异常处理器。
  66. // addGlobalUncaughtErrorHandler((event) => console.log(event));
  67. // // 定义全局状态
  68. // initGlState();
  69. // //启动qiankun
  70. // start({});
  71. // }
  72. //
  73. // export default registerApps;