Commit ff5057ad97b7e708643a69575fa8c3c2ccb111f6

Authored by zhangdaiscott
1 parent cc2ec317

前端集成qiankun,支持微前端开发

ant-design-vue-jeecg/src/components/layouts/TabLayout.vue
@@ -28,6 +28,9 @@ @@ -28,6 +28,9 @@
28 </template> 28 </template>
29 <!-- update-end-author:taoyan date:20201221 for:此处删掉transition标签 不知道为什么加上后 页面路由切换的时候即1及菜单切到2及菜单的时候 两个菜单页面会同时出现300-500秒左右 --> 29 <!-- update-end-author:taoyan date:20201221 for:此处删掉transition标签 不知道为什么加上后 页面路由切换的时候即1及菜单切到2及菜单的时候 两个菜单页面会同时出现300-500秒左右 -->
30 </div> 30 </div>
  31 + <!-- update-begin-author:zyf date:20211129 for:qiankun 挂载子应用盒子 -->
  32 + <div id="content" class="app-view-box"></div>
  33 + <!-- update-end-author:zyf date:20211129 for: qiankun 挂载子应用盒子-->
31 </global-layout> 34 </global-layout>
32 </template> 35 </template>
33 36
@@ -38,6 +41,7 @@ @@ -38,6 +41,7 @@
38 import { triggerWindowResizeEvent } from '@/utils/util' 41 import { triggerWindowResizeEvent } from '@/utils/util'
39 import Vue from 'vue' 42 import Vue from 'vue'
40 import { CACHE_INCLUDED_ROUTES } from '@/store/mutation-types' 43 import { CACHE_INCLUDED_ROUTES } from '@/store/mutation-types'
  44 + import registerApps from "@/qiankun";
41 45
42 const indexKey = '/dashboard/analysis' 46 const indexKey = '/dashboard/analysis'
43 47
@@ -92,6 +96,14 @@ @@ -92,6 +96,14 @@
92 this.activePage = currentRoute.fullPath 96 this.activePage = currentRoute.fullPath
93 }, 97 },
94 mounted() { 98 mounted() {
  99 + if (process.env.VUE_APP_QIANKUN == 'true') {
  100 + //update-begin-author:zyf date:20211129 for:qiankun 注册子应用
  101 + if (!window.qiankunStarted) {
  102 + window.qiankunStarted = true;
  103 + registerApps();
  104 + }
  105 + //update-end-author:zyf date:20211129 for:qiankun 注册子应用
  106 + }
95 }, 107 },
96 watch: { 108 watch: {
97 '$route': function(newRoute) { 109 '$route': function(newRoute) {