fix(route): get correct item link (#17278)
When the `href` link inside the element is a relative link, the original handling would obtain an incorrect full link
This commit is contained in:
@@ -92,10 +92,10 @@ Specify options (in the format of query string) in parameter \`routeParams\` par
|
||||
} else {
|
||||
link = linkEle.is('a') ? linkEle.attr('href') : linkEle.find('a').attr('href');
|
||||
}
|
||||
// 补全绝对链接
|
||||
// 补全绝对链接或相对链接
|
||||
link = link.trim();
|
||||
if (link && !link.startsWith('http')) {
|
||||
link = `${new URL(url).origin}${link}`;
|
||||
link = (new URL(link, url)).href;
|
||||
}
|
||||
|
||||
const descEle = routeParams.get('itemDesc') ? item.find(routeParams.get('itemDesc')) : item;
|
||||
|
||||
Reference in New Issue
Block a user