如何在移动 phone 浏览器中强制重定向到新的 window 或标签页?
How to force the redirection to a new window or tab in a mobile phone browser?
我正在开发一个基本上是订单的“Vue”应用程序。
在最后一步,如果您选择直接付款,您将被重定向到一个安全的付款页面,在浏览器中打开一个新选项卡。
const url = "/api/es/orders/" + this.functionalId
globalAxios
.put(url, payload, config)
.then(res => {
if (res.data.dev_code) {
if (this.selectedResume === "payment") {
const urlPayment = Config.PAYMENT_URL + res.data.dev_code
window.open(urlPayment, "_blank")
}
}
})
.catch(error => console.log(error))
问题是它会在除手机以外的所有设备上执行此操作。
有什么理由不在手机上做吗?
我应该包括一些具体的东西吗?
我做错了什么?
感谢大家的宝贵时间和帮助
您应该在文档中使用 Vue Router for this. Look at the programmatic navigation 段。
使用 location.href = URL
这就是我所做的。还有 <a href=url>Here</a>
但他们需要 tap/click 它...
我正在开发一个基本上是订单的“Vue”应用程序。 在最后一步,如果您选择直接付款,您将被重定向到一个安全的付款页面,在浏览器中打开一个新选项卡。
const url = "/api/es/orders/" + this.functionalId
globalAxios
.put(url, payload, config)
.then(res => {
if (res.data.dev_code) {
if (this.selectedResume === "payment") {
const urlPayment = Config.PAYMENT_URL + res.data.dev_code
window.open(urlPayment, "_blank")
}
}
})
.catch(error => console.log(error))
问题是它会在除手机以外的所有设备上执行此操作。 有什么理由不在手机上做吗? 我应该包括一些具体的东西吗? 我做错了什么?
感谢大家的宝贵时间和帮助
您应该在文档中使用 Vue Router for this. Look at the programmatic navigation 段。
使用 location.href = URL
这就是我所做的。还有 <a href=url>Here</a>
但他们需要 tap/click 它...