Dva框架如何让页面之间跳转


有三种方法

   (1)没有传参的话,可以有三种方法进行页面之间的跳转

            a.  <link to = '/experiment/information' >

            b.  this.props.history.push('/experiment/information') 

    (2)需要传参的话,可以使用dva的routerRedux来跳转路由

          步骤:1. 先引入    import { withRouter, routerRedux } from 'dva/router'

                     2. export default withRouter(connect(({dashboard}) => ({dashboard}))(TimeAxis))

                     3. this.props.dispatch(routerRedux.push({

                            pathname: '/experiment/information',
                            query: {id: id}
                         }))
       4.  而后,在跳转过去的model中可以获取所传递的参数
                         const params = location.query;


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM