wenlele
2 years ago
19 changed files with 226 additions and 96 deletions
@ -1,8 +1,12 @@ |
|||||
'use strict'; |
'use strict'; |
||||
|
|
||||
|
import './public-path' |
||||
import React from 'react'; |
import React from 'react'; |
||||
import { render } from 'react-dom'; |
import { render } from 'react-dom'; |
||||
import App from './app'; |
import App from './app'; |
||||
import './index.less'; |
import './index.less'; |
||||
|
import microApp from '@micro-zoe/micro-app' |
||||
|
|
||||
render((<App projectName="飞尚物联" />), document.getElementById('App')); |
microApp.start() |
||||
|
|
||||
|
render((<App projectName="飞尚物联" />), document.getElementById('IotAuthApp')); |
@ -0,0 +1,7 @@ |
|||||
|
// __MICRO_APP_ENVIRONMENT__和__MICRO_APP_PUBLIC_PATH__是由micro-app注入的全局变量
|
||||
|
if (window.__MICRO_APP_ENVIRONMENT__) { |
||||
|
// eslint-disable-next-line
|
||||
|
__webpack_public_path__ = window.__MICRO_APP_PUBLIC_PATH__ |
||||
|
} else { |
||||
|
__webpack_public_path__ = '/' |
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
export default { |
||||
|
|
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import MicroApp from './microApp'; |
||||
|
|
||||
|
export { MicroApp }; |
@ -0,0 +1,37 @@ |
|||||
|
import React, { useEffect } from 'react'; |
||||
|
import { connect } from 'react-redux'; |
||||
|
import { Spin, Card } from '@douyinfe/semi-ui'; |
||||
|
|
||||
|
const MicroApp = (props) => { |
||||
|
const { dispatch, actions, } = props |
||||
|
|
||||
|
return ( |
||||
|
<div> |
||||
|
<p>MicroApp</p> |
||||
|
<div style={{ |
||||
|
height: 'calc(100% - 64px)', overflow: 'auto', position: 'absolute', |
||||
|
}}> |
||||
|
<micro-app |
||||
|
name='microapp-test' |
||||
|
url='http://localhost:5000/' |
||||
|
baseroute='/microApp' |
||||
|
inline |
||||
|
// disableSandbox |
||||
|
// shadowDOM |
||||
|
style={{height:'100%'}} |
||||
|
> |
||||
|
microApp |
||||
|
</micro-app> |
||||
|
</div> |
||||
|
</div> |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
function mapStateToProps (state) { |
||||
|
const { auth, global } = state; |
||||
|
return { |
||||
|
|
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
export default connect(mapStateToProps)(MicroApp); |
@ -0,0 +1,15 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import reducers from './reducers'; |
||||
|
import routes from './routes'; |
||||
|
import actions from './actions'; |
||||
|
import { getNavItem } from './nav-item'; |
||||
|
|
||||
|
export default { |
||||
|
key: 'microApp', |
||||
|
name: 'MicroApp', |
||||
|
reducers: reducers, |
||||
|
routes: routes, |
||||
|
actions: actions, |
||||
|
getNavItem: getNavItem |
||||
|
}; |
@ -0,0 +1,13 @@ |
|||||
|
import React from 'react'; |
||||
|
import { IconCode } from '@douyinfe/semi-icons'; |
||||
|
|
||||
|
export function getNavItem (user, dispatch) { |
||||
|
return ( |
||||
|
[ |
||||
|
{ |
||||
|
itemKey: 'MicroApp', text: 'MicroApp', icon: <IconCode />, |
||||
|
to: '/microApp', |
||||
|
}, |
||||
|
] |
||||
|
); |
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
export default { |
||||
|
|
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
'use strict'; |
||||
|
import { MicroApp, } from './containers'; |
||||
|
|
||||
|
export default [{ |
||||
|
type: 'inner', |
||||
|
route: { |
||||
|
path: '/microApp', |
||||
|
key: 'microApp', |
||||
|
breadcrumb: 'microApp', |
||||
|
component: MicroApp, |
||||
|
} |
||||
|
}]; |
Loading…
Reference in new issue