When we click on the external link rendered from the database to the front-end page, if only the following two methods are used
1.window.location.href = 链接地址
2.window.open(a,b) a: external link, b: open method ("_blank" opens a new window; "_self" overwrites the current window)
We will find that the external links we open will automatically splice our source addresses, resulting in incorrect URL links and unable to access external links normally.
Referring to the writing method of other big guys, I successfully realized the jump to external links.
// url为传入的第三方链接或网址
goto(url){
// window.open(url,'_blank')
// window.location.href = url
let path=window.location.protocol+'//'+url
window.location.href=path
}
Learn to record and deepen your impression.