我收到一个有错误的空白页无法发布/注册/第二步.
我正在尝试创建多步骤注册。我的主要组件的渲染函数如下:
render() {
const languageReg = this.props.currentLanguage.default.registrationPage;
let stepOne = (this.props.params.id == 'step-one') ? <RegistrationFormStepOne actionSaveUser={this.props.actionSaveUser} currentLanguage={languageReg}/> : "";
let stepTwo = (this.props.params.id == 'step-two') ? <RegistrationFormStepTwo actionSaveUser={this.props.actionSaveUser} currentLanguage={languageReg}/> : "";
return (
<div className="sidebar-menu-container" id="sidebar-menu-container">
<div className="sidebar-menu-push">
<div className="sidebar-menu-overlay"></div>
<div className="sidebar-menu-inner">
<div className="contact-form registrationForm">
<div className="container">
<div className="row">
<div className="col-md-10 col-md-offset-1 col-md-offset-right-1">
{stepOne}
{stepTwo}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
在 RegistrationFormStepOne 中,我的点击功能如下:
handleClick(){
let data = {name: "stepOne", values: [this.state.user]};
this.context.router.push("/registration/step-two");
}
当我点击这个按钮时,url 应该是这样的http://localhost:3000/registration/step-two
但我得到了Cannot POST /registration/step-two
error.
当我直接输入http://localhost:3000/注册/步骤二效果很好。
我在用着反应无配置应用程序
有什么建议吗?
问题出在手柄点击功能上。我忘了防止违约。我把它改为:
handleClick(event){
event.preventDefault();
let data = {name: "stepOne", values: [this.state.user]};
this.context.router.push("/registration/step-two");
}
它起作用了。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)