fix(NewsEventsTab): 点击新闻事件在新标签页打开
- 将 navigate() 改为 window.open('_blank')
- 用户可以返回到新闻动态列表继续浏览
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
// 新闻动态 Tab 组件 - 黑金主题
|
// 新闻动态 Tab 组件 - 黑金主题
|
||||||
|
|
||||||
import React, { memo, useCallback } from 'react';
|
import React, { memo, useCallback } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
|
||||||
import { VStack, Card, CardBody } from '@chakra-ui/react';
|
import { VStack, Card, CardBody } from '@chakra-ui/react';
|
||||||
import { getEventDetailUrl } from '@/utils/idEncoder';
|
import { getEventDetailUrl } from '@/utils/idEncoder';
|
||||||
import { THEME_PRESETS } from './constants';
|
import { THEME_PRESETS } from './constants';
|
||||||
@@ -52,20 +51,18 @@ const NewsEventsTab: React.FC<NewsEventsTabProps> = ({
|
|||||||
cardBg,
|
cardBg,
|
||||||
themePreset = 'default',
|
themePreset = 'default',
|
||||||
}) => {
|
}) => {
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
// 获取主题配色
|
// 获取主题配色
|
||||||
const theme = THEME_PRESETS[themePreset] || THEME_PRESETS.default;
|
const theme = THEME_PRESETS[themePreset] || THEME_PRESETS.default;
|
||||||
const isBlackGold = themePreset === 'blackGold';
|
const isBlackGold = themePreset === 'blackGold';
|
||||||
|
|
||||||
// 点击事件卡片,跳转到详情页
|
// 点击事件卡片,在新标签页打开详情页
|
||||||
const handleEventClick = useCallback(
|
const handleEventClick = useCallback(
|
||||||
(eventId: string | number | undefined) => {
|
(eventId: string | number | undefined) => {
|
||||||
if (eventId) {
|
if (eventId) {
|
||||||
navigate(getEventDetailUrl(eventId));
|
window.open(getEventDetailUrl(eventId), '_blank');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[navigate]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
// 处理搜索输入
|
// 处理搜索输入
|
||||||
|
|||||||
Reference in New Issue
Block a user