react页面跳转时带值跳转 dva+react

dispatch(routerRedux.push("/register/register?patno="+result.patno))/// ?前面为地址   在跳转之前的页面操
    const { app:{locationQuery }} = this.props; ////跳转之后的页面接收值
    console.log(locationQuery) /////打印要传的
  locationQuery是自定义的方法需要在全局组件中生命该方法
subscriptions: {
setupHistory ({ dispatch, history }) {
history. listen(( location) => {
dispatch({
type: 'updateState',
payload: {
locationPathname: location. pathname,
locationQuery: queryString. parse( location. search),
},
});
})
}
},


猜你喜欢

转载自blog.csdn.net/weixin_42046201/article/details/81003319