[Vue] vue跳转外部链接

vue跳转外部链接

vue 跳转外部链接问题,当跳转的时候会添加在当前地址后面。

var url = 'www.baidu.com'

//跳转1
window.localtion.href = url

//跳转2
window.history.pushState(url);
window.history.replaceState(url);

//跳转3
window.open(url,"_blank");

//跳转4
var a = document.createElement("a");
a.setAttribute("href", "www.baidu.com");
a.setAttribute("target", "_blank");
a.click();

猜你喜欢

转载自blog.csdn.net/weixin_42776111/article/details/108866770