trunk/pc4mobx/organization/single.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-05-05 16:02:19 +08:00
import React from 'react';
import ReactDOM from 'react-dom';
import { createHashHistory } from 'History';
import { Router, Route, useRouterHistory, IndexRedirect } from 'react-router';
import { syncHistoryWithStore, RouterStore } from 'mobx-react-router';
import { Provider } from 'mobx-react';
import Module from 'weaOrganization';
const routing = new RouterStore();
const allStore = {
routing,
...Module.store,
};
const browserHistory = useRouterHistory(createHashHistory)({
queryKey: '_key',
basename: '/',
});
const history = syncHistoryWithStore(browserHistory, allStore.routing);
const Home = props => props.children;
const Root = () => (
<Provider {...allStore}>
<Router history={history}>
<Route name='root' breadcrumbName='根路由' path='/' component={Home}>
2022-05-06 16:53:43 +08:00
<IndexRedirect to='main/organization/index' />
2022-05-05 16:02:19 +08:00
<Route name='main' breadcrumbName='入口' path='/main' component={Home}>
{ Module.Route }
</Route>
</Route>
</Router>
</Provider>
);
ReactDOM.render(<Root />, document.getElementById('container'));