click subpath

This commit is contained in:
2025-04-10 18:07:10 +08:00
parent 48d5bdafa4
commit b8cd3716c4
5 changed files with 68 additions and 10 deletions

View File

@@ -481,8 +481,20 @@ function AnalyticsContent() {
// 处理子路径点击
const handlePathClick = (path: string) => {
console.log('Path clicked:', path);
setSelectedSubpath(path);
console.log('====== ANALYTICS PAGE PATH DEBUG ======');
console.log('Original path:', path);
// 从路径中提取 subpath 部分,移除前导斜杠
// 示例:如果路径是 "/slug/subpath",我们需要提取 "subpath" 部分
// 或者直接使用原始路径,取决于您的路径结构
const pathParts = path.split('/').filter(Boolean);
// 如果路径包含多个部分获取第二部分subpath
const subpath = pathParts.length > 1 ? pathParts[1] : path;
console.log('Extracted subpath:', subpath);
console.log('=====================================');
setSelectedSubpath(subpath);
// 重置到第一页
setCurrentPage(1);
};