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
const Routers = function ({history, app}) { const routes = [ { path: '/', component: App, indexRoute: { component: Welcome, }, childRoutes: [ { path: 'index', childRoutes: [ { path: 'option1', name: 'option1', tableName: 'test', getComponent: DBTableContainer, }, { path: 'programme', name: 'programme', component: ProgrammeIndex, }, { path: 'project', name: 'project', tableName: 'project', getComponent: DBTableContainer, }, { path: 'option2', component: Error, }, ], }, { path: '*', component: Error, }, ], }, ]; return <Router history={history} routes={routes}/>; }; Routers.propTypes = { history: PropTypes.object, app: PropTypes.object, }; export default Routers;
以上写法以前可以
现在这写法不支持了,用新的写法,非redux组件中的this.props变成了其他内容,不是react的内容,非常支持新版本的更新,但this.props变成了其他内容是咋回事?
出问题地方如下
class App extends React.Component { componentWillMount() { console.log(this.props); } ............... } ```````` 新路由写法为 这里贴的代码有问题.... `````` import React from 'react'; import PropTypes from 'prop-types'; import {Switch, Route, Redirect, routerRedux} from 'dva/router'; import dynamic from 'dva/dynamic'; import App from './components/App'; import Welcome from './components/Welcome'; import Error from './components/Error'; const {ConnectedRouter} = routerRedux; const Routers = function ({history, app}) { return ( <ConnectedRouter history={history}> <App> <Switch> <Route exact path="/" render={() => (<Redirect to="/welcome"/>)}/> <Route key="welcome" exact path="/welcome" component={Welcome} /> <Route component={Error}/> </Switch> </App> </ConnectedRouter> ); }; Routers.propTypes = { history: PropTypes.object, app: PropTypes.object, }; export default Routers;
1.2.1-->2.0.1后出现
The text was updated successfully, but these errors were encountered:
你直接升级dva,这个肯定是不支持的,因为dva使用的路由版本是4,已经不兼容3这种写法了,你如果要兼容,去看作者发的issue,我就是按照里面这个升级的,把dva换成dva-react-router-3。issue地址:sorrycc/blog#48
Sorry, something went wrong.
@longzhaobi 请问直接npm install dva-react-router-3 --save 然后把import { browserHistory } from 'dva/router' 改成 import { browserHistory } from 'dva-react-router-3/router' 就可以了吗?
No branches or pull requests
Code to reproduce the issue: (请提供可复现的代码或者步骤)
Expected behavior: (预期的正常效果)
以上写法以前可以
Actual behavior: (实际效果)
现在这写法不支持了,用新的写法,非redux组件中的this.props变成了其他内容,不是react的内容,非常支持新版本的更新,但this.props变成了其他内容是咋回事?
出问题地方如下
Versions of packages used: (哪个库的哪个版本出现的问题)
1.2.1-->2.0.1后出现
The text was updated successfully, but these errors were encountered: