🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
~~~ //src>routes>indexpages.js function IndexPage({dispatch,count}) { const testClick = () => { dispatch({ type: 'example/redirect', }); } return ( <div > <h2 onClick={testClick}>路由跳转</h2> </div> ); } //用于连接模板文件与models文件 export default connect()(IndexPage); ~~~ ~~~ //src>models>example.js import { routerRedux } from 'dva/router'; effects: { // 路由跳转 * redirect ({ payload }, { put }) { yield put(routerRedux.push('/detail/', {name: 'DetailPage'})); }, }, ~~~ 另外一种: ~~~ this.props.history.push('/componentmarket/list',state); ~~~