lintfix
This commit is contained in:
@@ -20,28 +20,28 @@ const pageFontSizeClass = computed(() => {
|
||||
|
||||
// 根据路由参数构建内容路径
|
||||
const path = computed(() => {
|
||||
const slug = route.params.slug;
|
||||
const slug = route.params.slug
|
||||
|
||||
// 处理 slug 参数
|
||||
if (!slug) {
|
||||
return '/'; // 如果没有 slug,返回根路径
|
||||
return '/' // 如果没有 slug,返回根路径
|
||||
}
|
||||
|
||||
const pathValue = Array.isArray(slug) ? slug.join("/") : slug;
|
||||
const pathValue = Array.isArray(slug) ? slug.join('/') : slug
|
||||
|
||||
// 确保路径以 / 开头,不以 / 结尾
|
||||
const normalizedPath = `/${pathValue}`.replace(/\/+$/, ""); // 使用 /+ 匹配多个连续的斜杠
|
||||
const normalizedPath = `/${pathValue}`.replace(/\/+$/, '') // 使用 /+ 匹配多个连续的斜杠
|
||||
|
||||
return normalizedPath;
|
||||
});
|
||||
return normalizedPath
|
||||
})
|
||||
|
||||
// URL 解码并验证路径
|
||||
const queryPath = computed(() => {
|
||||
try {
|
||||
return decodeURIComponent(path.value);
|
||||
return decodeURIComponent(path.value)
|
||||
} catch (error) {
|
||||
console.error('URL decode error:', error);
|
||||
return path.value; // 如果解码失败,返回原始路径
|
||||
console.error('URL decode error:', error)
|
||||
return path.value // 如果解码失败,返回原始路径
|
||||
}
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user