【发布时间】:2023-03-18 18:12:01
【问题描述】:
我目前有一个使用 history.push 将用户推送到不同页面的功能。如果用户在当前路径并决定点击同一路径重新渲染当前页面,是否有可能?
例如,来自下面的代码。如果用户在 /home/reportanissue/createissue 中,如果他们决定单击相同的 url 路径,则预期的行为是重新呈现页面。
谢谢
handleMenuItemClick(event) {
switch (event.currentTarget.id) {
case "mainPage":
this.props.history.push("/home/reportanissue");
break;
case "myTasks":
this.props.history.push("/home/reportanissue/managemytasks");
break;
case "myQueues":
this.props.history.push("/home/reportanissue/myqueues");
break;
case "createNewIssue":
this.props.history.push("/home/reportanissue/createissue");
break;
case "submitException":
this.props.history.push("/home/reportanissue/submitnewexception");
break;
default:
return;
}
}
【问题讨论】:
标签: javascript reactjs react-router