62 lines
1.4 KiB
JavaScript
62 lines
1.4 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 Apidoc from './index'; // umd
|
||
|
|
// import Workflow from './index'
|
||
|
|
// import {IndexRedirect} from 'react-router';
|
||
|
|
const ApidocStore = Apidoc.stores;
|
||
|
|
const routing = new RouterStore();
|
||
|
|
const ApidocRoute = Apidoc.Route;
|
||
|
|
import Comstore from 'comsMobx';
|
||
|
|
|
||
|
|
const ComStore = Comstore.store;
|
||
|
|
// import "./style/single.less";
|
||
|
|
let stores = {
|
||
|
|
// Key can be whatever you want
|
||
|
|
routing,
|
||
|
|
...ComStore,
|
||
|
|
...ApidocStore,
|
||
|
|
};
|
||
|
|
|
||
|
|
const browserHistory = useRouterHistory(createHashHistory)({
|
||
|
|
queryKey: '_key',
|
||
|
|
basename: '/',
|
||
|
|
});
|
||
|
|
|
||
|
|
const history = syncHistoryWithStore(browserHistory, stores.routing);
|
||
|
|
|
||
|
|
class Home extends React.Component {
|
||
|
|
render() {
|
||
|
|
return this.props.children;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class Root extends React.Component {
|
||
|
|
render() {
|
||
|
|
return (
|
||
|
|
<Provider {...stores}>
|
||
|
|
<Router history={history}>
|
||
|
|
{/* <Route path="/"> */}
|
||
|
|
{/* <Route name="main" breadcrumbName="入口" path="main" component={Home}> */}
|
||
|
|
{ApidocRoute}
|
||
|
|
{/* </Route> */}
|
||
|
|
{/* </Route> */}
|
||
|
|
</Router>
|
||
|
|
</Provider>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
ReactDOM.render(<Root />, document.getElementById('container'));
|