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:
XieSC
2024-10-27 01:38:35 +08:00
committed by GitHub
parent d79e6cdf56
commit 9916c348bb
+2 -2
View File
@@ -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;