fix: 修复 key 重复
This commit is contained in:
@@ -469,13 +469,13 @@ const FlowingConcepts = () => {
|
|||||||
const row3 = concepts.slice(20, 30);
|
const row3 = concepts.slice(20, 30);
|
||||||
|
|
||||||
// 渲染单个概念卡片
|
// 渲染单个概念卡片
|
||||||
const renderConceptCard = (concept, globalIdx) => {
|
const renderConceptCard = (concept, globalIdx, uniqueIdx) => {
|
||||||
const colors = getColor(concept.change_pct);
|
const colors = getColor(concept.change_pct);
|
||||||
const isActive = hoveredIdx === globalIdx;
|
const isActive = hoveredIdx === globalIdx;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
key={globalIdx}
|
key={`${globalIdx}-${uniqueIdx}`}
|
||||||
flexShrink={0}
|
flexShrink={0}
|
||||||
px={3}
|
px={3}
|
||||||
py={2}
|
py={2}
|
||||||
@@ -582,7 +582,7 @@ const FlowingConcepts = () => {
|
|||||||
>
|
>
|
||||||
{/* 复制两份实现无缝滚动 */}
|
{/* 复制两份实现无缝滚动 */}
|
||||||
{[...items, ...items].map((concept, idx) =>
|
{[...items, ...items].map((concept, idx) =>
|
||||||
renderConceptCard(concept, startIdx + (idx % items.length))
|
renderConceptCard(concept, startIdx + (idx % items.length), idx)
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user