小白使用React---ajax请求成功后跳转到另一个页面
发布时间:2020-12-15 06:38:46 所属栏目:百科 来源:网络整理
导读:$.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
$.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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |