trunk/pc4backstage/integration/debug.js

47 lines
1.5 KiB
JavaScript

import React from 'react';
import ReactDOM from 'react-dom';
import { createHashHistory } from 'History';
import { Router, Route, useRouterHistory } from 'react-router';
import { syncHistoryWithStore, RouterStore } from 'mobx-react-router';
import { Provider } from 'mobx-react';
import { WeaDebugRouteMenu } from 'ecCom';
WeaDebugRouteMenu.defaultProps.showRouteLev = 3;
import Module from './index';
const routing = new RouterStore();
const allStore = {
routing,
...Module.store,
};
const browserHistory = useRouterHistory(createHashHistory)({
queryKey: '_key',
basename: '/',
});
const history = syncHistoryWithStore(browserHistory, allStore.routing);
window.weaHistory = history;
const Home = props => props.children;
const Root = () => (
<Provider ecId={`${this && this.props && this.props.ecId || ''}_Provider@aldn6r`} {...allStore}>
<Router ecId={`${this && this.props && this.props.ecId || ''}_Router@zi4yo1`} history={history}>
<Route ecId={`${this && this.props && this.props.ecId || ''}_Route@f8cf6v`} name='root' breadcrumbName='根路由' path='/' component={WeaDebugRouteMenu}>
<Route ecId={`${this && this.props && this.props.ecId || ''}_Route@2tcn0t`} name='main' breadcrumbName='入口' path='main' component={Home}>
{ Module.Route }
</Route>
</Route>
</Router>
</Provider>
);
ReactDOM.render(<Root ecId={`${this && this.props && this.props.ecId || ''}_Root@55j4aj`} />, document.getElementById('container'));