From b30cbd6c626d7ffa1919cb3aaace001304c8363d Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Fri, 7 Nov 2025 19:32:36 +0800 Subject: [PATCH] =?UTF-8?q?RelatedStocksSection=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E4=B8=BA=E7=BA=AF=E8=AF=A6=E7=BB=86=E6=A8=A1=E5=BC=8F=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DynamicNewsDetail/RelatedStocksSection.js | 80 ++++--------------- 1 file changed, 14 insertions(+), 66 deletions(-) diff --git a/src/views/Community/components/DynamicNewsDetail/RelatedStocksSection.js b/src/views/Community/components/DynamicNewsDetail/RelatedStocksSection.js index 8802db74..2be81942 100644 --- a/src/views/Community/components/DynamicNewsDetail/RelatedStocksSection.js +++ b/src/views/Community/components/DynamicNewsDetail/RelatedStocksSection.js @@ -1,21 +1,13 @@ // src/views/Community/components/DynamicNewsDetail/RelatedStocksSection.js // 相关股票列表区组件(纯内容,不含标题) -import React, { useState } from 'react'; -import { - VStack, - Flex, - Button, - ButtonGroup, - Wrap, - WrapItem, -} from '@chakra-ui/react'; -import { ViewIcon, ViewOffIcon } from '@chakra-ui/icons'; +import React from 'react'; +import { VStack } from '@chakra-ui/react'; import StockListItem from './StockListItem'; -import CompactStockItem from './CompactStockItem'; /** * 相关股票列表区组件(纯内容部分) + * 只负责渲染详细的股票列表,精简模式由外层 CollapsibleSection 的 simpleContent 提供 * @param {Object} props * @param {Array} props.stocks - 股票数组 * @param {Object} props.quotes - 股票行情字典 { [stockCode]: { change: number } } @@ -30,67 +22,23 @@ const RelatedStocksSection = ({ watchlistSet = new Set(), onWatchlistToggle }) => { - // 显示模式:'detail' 详情模式, 'compact' 精简模式 - const [viewMode, setViewMode] = useState('detail'); - // 如果没有股票数据,不渲染 if (!stocks || stocks.length === 0) { return null; } return ( - - {/* 模式切换按钮 */} - - - - - - - - {/* 详情模式 */} - {viewMode === 'detail' && ( - - {stocks.map((stock, index) => ( - - ))} - - )} - - {/* 精简模式 */} - {viewMode === 'compact' && ( - - {stocks.map((stock, index) => ( - - - - ))} - - )} + + {stocks.map((stock, index) => ( + + ))} ); };