我正在使用下一个js路由并使用路由器。
Router.push({
pathname: this.props.router.pathname,
asPath: this.props.router.asPath,
query: { action: "follow" },
});
router.push浏览器在下一个js中显示路径名 http://localhost:3000/mentor/[id]?action=follow
它应为asPath之类: http://localhost:3000/mentor/162?action=follow
答案 0 :(得分:0)
添加浅:true
Router.push({
pathname: this.props.router.pathname,
asPath: this.props.router.asPath,
query: { action: "follow" },
{ shallow: true }
});