File tree Expand file tree Collapse file tree 7 files changed +44
-2
lines changed
Expand file tree Collapse file tree 7 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -19,4 +19,9 @@ export default defineConfig({
1919 { path : '/index' , component : '@/pages/Index/index' } ,
2020 ] ,
2121 fastRefresh : { } ,
22+ // qiankun: {
23+ // master: {
24+ // apps:[]
25+ // }
26+ // }
2227} ) ;
Original file line number Diff line number Diff line change 1+ export default {
2+ // 微前端
3+ 'GET /api/microApp/index' : {
4+ component : "page" ,
5+ style : {
6+ height : '100vh' ,
7+ } ,
8+ body : {
9+ component : "layout" ,
10+ cache : true ,
11+ body : {
12+ component : "microApp" ,
13+ name : 'app1'
14+ }
15+ }
16+ }
17+ }
18+
Original file line number Diff line number Diff line change 3434 "devDependencies" : {
3535 "@types/react" : " ^17.0.0" ,
3636 "@types/react-dom" : " ^17.0.0" ,
37+ "@umijs/plugin-qiankun" : " ^2.26.0" ,
3738 "@umijs/test" : " ^3.4.7" ,
3839 "husky" : " ^4.3.0" ,
3940 "lint-staged" : " ^10.0.7" ,
Original file line number Diff line number Diff line change 11{
2- "initApi" : " admin/login"
2+ "initApi" : " admin/login" ,
3+ "apps" : [
4+ {
5+ "name" : " app1" ,
6+ "entry" : " //www.baidu.com"
7+ }
8+ ]
39}
Original file line number Diff line number Diff line change @@ -67,3 +67,10 @@ export const request: RequestConfig = {
6767 }
6868 ] ,
6969} ;
70+
71+ // 从接口中获取子应用配置,export 出的 qiankun 变量是一个 promise
72+ export const qiankun = fetch ( './config.json' )
73+ . then ( response => response . json ( ) )
74+ . then ( response => ( {
75+ apps : response . apps
76+ } ) )
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ const RightContent: React.FC<any> = (props) => {
1818 }
1919
2020 if ( event . key === 'setting' ) {
21- history . push ( { pathname : '/index' , query : { api :'admin/account/setting' } } ) ;
21+ history . push ( { pathname : '/index' , query : { api :'admin/account/setting-form ' } } ) ;
2222 return ;
2323 }
2424
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import Paragraph from '@/components/Typography/Paragraph';
2121import Title from '@/components/Typography/Title' ;
2222import Text from '@/components/Typography/Text' ;
2323import { Space } from 'antd' ;
24+ import { MicroApp } from 'umi' ;
2425import { dataMapping , tplEngine } from '@/utils/template' ;
2526
2627const Render : React . FC < any > = ( props :any ) => {
@@ -123,6 +124,10 @@ const Render: React.FC<any> = (props:any) => {
123124 key : 'login' ,
124125 component : < Login { ...body } callback = { callback } data = { data } />
125126 } ,
127+ // {
128+ // key: 'microApp',
129+ // component: <MicroApp {...body} callback={callback} data={data} />
130+ // },
126131 {
127132 key : 'tpl' ,
128133 component : < > { tplEngine ( body . body , data ) } </ >
You can’t perform that action at this time.
0 commit comments