React Router browserHistory.push在新选项卡中打开链接 [英] React Router browserHistory.push open link in a new tab

查看:481
本文介绍了React Router browserHistory.push在新选项卡中打开链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以使用< link> 作为

<Link to="route" target="_blank">

在新标签页中打开链接。但是可以使用 browserHistory.push 在新标签中打开链接吗?

to open links in new tab. But is it possible to use browserHistory.push to open links in a new tab?

推荐答案

React-router构建于浏览器History API之上。
browserHistory.push 调用 pushState() 方法。

React-router is build on the browser History API. browserHistory.push calls pushState() method.

从第一个开始链接文档的行:

From the first line of the linked document:


pushState()有三个参数:状态对象,标题(当前被忽略),以及(可选)统一资源定位器(URL)。

pushState( ) takes three parameters: A state object, a title (which is currently ignored), and (optionally) a Uniform Resource Locator (URL).

因此,您的问题的答案是否。

So, the answer to your question is "No".

这篇关于React Router browserHistory.push在新选项卡中打开链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆