We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
版本
"dva": "^1.2.1", "history": "^4.6.1", "react": "^15.4.0",
import dva from 'dva'; import { createHashHistory } from 'history'; import { browserHistory, hashHistory, useRouterHistory } from 'dva/router'; import createLoading from 'dva-loading'; const app = dva({ ...createLoading(), history: useRouterHistory(createHashHistory)({ queryKey: false }), onError (error) { console.error('app onError -- ', error); } }); // 2. Plugins // app.use({}); // 3. Model app.model(require('./models/app')); // app.model(require("./models/main")); // 4. Router app.router(require('./router')); // 5. Start app.start('#root');
import React, { PropTypes } from 'react'; import { Router, Route, browserHistory } from 'dva/router'; import App from './routes/app/'; function Routers ({ history, app }) { const routes = [{ path: '/', component: App, getIndexRoute (nextState, cb) { require.ensure([], require => { cb(null, { components: require('./routes/main/') }); }, 'main'); }, childRoutes: [ { path: '/console', getComponent (nextState, cb) { require.ensure([], require => { cb(null, require('./routes/console/')); }, 'console'); } }, { path: '*', getComponent (nextState, cb) { require.ensure([], require => { cb(null, require('./routes/error/')); }, 'error'); } } ] }]; return (<Router history={history} routes={routes} />); } Routers.propTypes = { history: PropTypes.object, app: PropTypes.object }; export default Routers;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
版本
入口 index.js
路由 router.js
The text was updated successfully, but these errors were encountered: