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();