feat: 处理热词点击逻辑
This commit is contained in:
@@ -93,14 +93,23 @@ const PopularKeywords = ({ onKeywordClick, keywords: propKeywords }) => {
|
|||||||
return `${formatted}%`;
|
return `${formatted}%`;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理概念标签点击 - 跳转到对应概念页面
|
// ✅ 修复:处理概念标签点击
|
||||||
const handleConceptClick = (concept) => {
|
const handleConceptClick = (concept) => {
|
||||||
// 如果原有的 onKeywordClick 存在,可以选择是否还要调用
|
// 优先调用父组件传入的回调(用于搜索框显示和触发搜索)
|
||||||
// onKeywordClick && onKeywordClick(concept.keyword);
|
if (onKeywordClick) {
|
||||||
|
onKeywordClick(concept.keyword);
|
||||||
// 跳转到对应概念的页面
|
logger.debug('PopularKeywords', '调用 onKeywordClick 回调', {
|
||||||
const url = `${DOMAIN_PREFIX}/htmls/${encodeURIComponent(concept.keyword)}.html`;
|
keyword: concept.keyword
|
||||||
window.open(url, '_blank');
|
});
|
||||||
|
} else {
|
||||||
|
// 如果没有回调,则跳转到对应概念的页面(原有行为)
|
||||||
|
const url = `${DOMAIN_PREFIX}/htmls/${encodeURIComponent(concept.keyword)}.html`;
|
||||||
|
window.open(url, '_blank');
|
||||||
|
logger.debug('PopularKeywords', '跳转到概念页面', {
|
||||||
|
keyword: concept.keyword,
|
||||||
|
url
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理"更多概念"按钮点击 - 跳转到概念中心
|
// 处理"更多概念"按钮点击 - 跳转到概念中心
|
||||||
|
|||||||
Reference in New Issue
Block a user