一般单页面应用,当你使用useNavigate时候的时候,用useNavigate来跳转,只能是在当前页面刷新跳转的,要想单独在一个tab页打开新页面,大概用三种方式。
使用link标签,配合target实现
- <Link to="/record" target="_blank">
- /record
- </Link>
使用a标签,配合target实现
- <a href="/record" target="_blank">
- /record
- </a>
使用window.open来实现
- const navigateOutApp = () => window.open("/record", "_blank", "noreferrer");
-
- ...
-
- <button type="button" onClick={navigateOutApp}>
- /record
- </button>
