您的位置:首页 > Web前端 > React

小白使用React---ajax请求成功后跳转到另一个页面

2017-12-05 19:42 447 查看
$.ajax({
type:"GET",
url:this.url,
dataType:"json",
success:function (result) {
if(result.meta.success===true){
that.setState({contents: result.data});
let content=JSON.stringify(result.data);
localStorage.setItem("searchlists",content);
that.props.history.push( '/srmp/v1/contents',null)
}
},
error:function(xhr,status, err) {
console.error( status, err.toString());
// hashHistory.push('/srmp/v1/contents')
// const win = window.open('/srmp/v1/contents', '_blank');
// win.focus();
// browserHistory.push('/srmp/v1/contents');
// that.props.history.push( '/srmp/v1/contents',null)
}
});

加红色的这句话

第一个参数是跳转路由,path

第二个参数是state,想要传入的参数

路由传参的三种方法

http://blog.csdn.net/qq_23158083/article/details/68488831
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: