ant-design-react报错Each child in a list should have a unique “key“ prop...

  1. 报错如下:
    图片1
  2. 解决方法:添加row-key={columns => columns.id || columns.index},如下:
    图片2
import React, { useState, useEffect } from 'react'; import {Card, Col, Row, Tabs} from 'antd'; import { PageContainer } from '@ant-design/pro-components'; import BusinessSystemList from './sysview'; import DomainProcessPage from './processview'; import BusinessObjectList from './objview'; import AssetsView from './assetsview' const DomainContent: React.FC = () => { const [domainId, setDomainId] = useState<string | null>(''); const [domainName, setDomainName] = useState<string | null>(''); const [bussObj, setBussObj] = useState<string | null>(''); const [processPoint, setProcessPoint] = useState<string | null>(''); const [sys, setSys] = useState<string | null>(''); // 页面加载时从 URL 获取 domainId useEffect(() => { const query = new URLSearchParams(window.location.search); const id = query.get('domain'); const domainName = query.get('domainName'); setDomainName(domainName) setDomainId(id); }, []); // 处理子组件点击事件的回调函数 const handleSysClick = (data: any) => { setSys(data.sysName) setProcessPoint('') setBussObj('') }; const handleProcessClick = (data: any) => { setSys('') setProcessPoint(data.target.innerHTML) setBussObj('') }; const handleObjClick = (data: any) => { setSys('') setProcessPoint('') setBussObj(data.objName) // 在这里处理业务对象点击逻辑 }; // @ts-ignore return ( <PageContainer> <Row> <Col offset={2} style={{fontWeight:'bold'}}> 领域名称: <span>{domainName || '暂无数据'}</span> </Col> </Row> <Row gutter={8} style={{marginTop:8}}> <Col span={2}> </Col> <Col span={7} style={{ maxHeight: '80vh', // 设置最大高度 overflowY: 'auto', // 超出显示滚动条 padding: '0 8px', // 可选:增加内边距避免贴边 }}> <Card> <Tabs defaultActiveKey="businessSystem" destroyInactiveTabPane={false} > <Tabs.TabPane key="businessSystem" tab="业务系统"> <BusinessSystemList key={domainId + "sys"} domainId={domainId} onRowClick={handleSysClick} /> </Tabs.TabPane> <Tabs.TabPane key="endToEndProcess" tab="端到端流程"> <DomainProcessPage key={domainId + "process"} domainId={domainId} onNodeClick={handleProcessClick} /> </Tabs.TabPane> <Tabs.TabPane key="businessObject" tab="业务对象"> <BusinessObjectList key={domainId + "obj"} domainId={domainId} onRowClick={handleObjClick} /> </Tabs.TabPane> </Tabs> </Card> </Col> <Col span={13}> <AssetsView bussObj={bussObj || ''} domain={domainId || ''} processPoint={processPoint || ''} sys={sys || ''} /> </Col> <Col span={2}> </Col> </Row> </PageContainer> ); }; export default DomainContent; 报错 Each child in a list should have a unique "key" prop.
08-30
那个左右滑动切换的问题,我正在排查,最终定位到是赛事赛题列表组件的问题(隐藏这个组件可以滑动),我怀疑是报错信息未解决导致划动不了,我查看浏览器报错:WebSocket connection to 'wss://localhost.chasiwu-sit.chaspark.cn:8087/?token=lBdndKpQW9Jz' failed: createConnection @ client:755 connect @ client:426 connect @ client:764 connect @ client:279 connect @ client:372 (anonymous) @ client:861Understand this errorAI client:768 WebSocket connection to 'wss://localhost:8087/?token=lBdndKpQW9Jz' failed: createConnection @ client:768 connect @ client:426 connect @ client:775Understand this errorAI client:783 [vite] failed to connect to websocket. your current setup: (browser) localhost.chasiwu-sit.chaspark.cn:8087/ <--[HTTP]--> localhost:8087/ (server) (browser) localhost.chasiwu-sit.chaspark.cn:8087/ <--[WebSocket (failing)]--> localhost:8087/ (server) Check out your Vite / network configuration and https://vite.dev/config/server-options.html#server-hmr . connect @ client:783 await in connect connect @ client:279 connect @ client:372 (anonymous) @ client:861Understand this errorAI chunk-FPEHBWIL.js?v=a329eec5:521 Warning: withRouter(CacheSwitch2): Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. at C2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/chunk-R4H6Z5XC.js?v=a329eec5:792:37) at DataProvider (https://localhost.chasiwu-sit.chaspark.cn:8087/src/h5/Contexts/DataContext.js:7:3) at default (https://localhost.chasiwu-sit.chaspark.cn:8087/src/h5/routes/index.js?t=1764215092864:14:16) at Suspense at Switch2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/chunk-R4H6Z5XC.js?v=a329eec5:1131:33) at Router2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/chunk-R4H6Z5XC.js?v=a329eec5:875:34) at Provider (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-redux.js?v=a329eec5:918:3) at ConfigProvider (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/antd-mobile.js?v=a329eec5:489:5) at IntlProvider3 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-intl.js?v=a329eec5:4204:45) at AppH5 at Suspense printWarning @ chunk-FPEHBWIL.js?v=a329eec5:521 error @ chunk-FPEHBWIL.js?v=a329eec5:505 validateFunctionComponentInDev @ chunk-FPEHBWIL.js?v=a329eec5:15067 mountIndeterminateComponent @ chunk-FPEHBWIL.js?v=a329eec5:15036 beginWork @ chunk-FPEHBWIL.js?v=a329eec5:15962 beginWork$1 @ chunk-FPEHBWIL.js?v=a329eec5:19806 performUnitOfWork @ chunk-FPEHBWIL.js?v=a329eec5:19251 workLoopConcurrent @ chunk-FPEHBWIL.js?v=a329eec5:19242 renderRootConcurrent @ chunk-FPEHBWIL.js?v=a329eec5:19217 performConcurrentWorkOnRoot @ chunk-FPEHBWIL.js?v=a329eec5:18728 workLoop @ chunk-FPEHBWIL.js?v=a329eec5:197 flushWork @ chunk-FPEHBWIL.js?v=a329eec5:176 performWorkUntilDeadline @ chunk-FPEHBWIL.js?v=a329eec5:384Understand this errorAI chunk-CZS4DZFE.js?v=a329eec5:183 Warning: [antd: Dropdown] `onVisibleChange` is deprecated which will be removed in next major version, please use `onOpenChange` instead. warning @ chunk-CZS4DZFE.js?v=a329eec5:183 call @ chunk-CZS4DZFE.js?v=a329eec5:202 warningOnce @ chunk-CZS4DZFE.js?v=a329eec5:207 warning4 @ antd.js?v=a329eec5:1070 (anonymous) @ antd.js?v=a329eec5:16296 Dropdown3 @ antd.js?v=a329eec5:16294 renderWithHooks @ chunk-FPEHBWIL.js?v=a329eec5:11596 mountIndeterminateComponent @ chunk-FPEHBWIL.js?v=a329eec5:14974 beginWork @ chunk-FPEHBWIL.js?v=a329eec5:15962 beginWork$1 @ chunk-FPEHBWIL.js?v=a329eec5:19806 performUnitOfWork @ chunk-FPEHBWIL.js?v=a329eec5:19251 workLoopSync @ chunk-FPEHBWIL.js?v=a329eec5:19190 renderRootSync @ chunk-FPEHBWIL.js?v=a329eec5:19169 performConcurrentWorkOnRoot @ chunk-FPEHBWIL.js?v=a329eec5:18728 workLoop @ chunk-FPEHBWIL.js?v=a329eec5:197 flushWork @ chunk-FPEHBWIL.js?v=a329eec5:176 performWorkUntilDeadline @ chunk-FPEHBWIL.js?v=a329eec5:384Understand this errorAI chunk-CZS4DZFE.js?v=a329eec5:183 Warning: [antd: Dropdown] `overlay` is deprecated. Please use `menu` instead. warning @ chunk-CZS4DZFE.js?v=a329eec5:183 call @ chunk-CZS4DZFE.js?v=a329eec5:202 warningOnce @ chunk-CZS4DZFE.js?v=a329eec5:207 warning4 @ antd.js?v=a329eec5:1070 Dropdown3 @ antd.js?v=a329eec5:16298 renderWithHooks @ chunk-FPEHBWIL.js?v=a329eec5:11596 mountIndeterminateComponent @ chunk-FPEHBWIL.js?v=a329eec5:14974 beginWork @ chunk-FPEHBWIL.js?v=a329eec5:15962 beginWork$1 @ chunk-FPEHBWIL.js?v=a329eec5:19806 performUnitOfWork @ chunk-FPEHBWIL.js?v=a329eec5:19251 workLoopSync @ chunk-FPEHBWIL.js?v=a329eec5:19190 renderRootSync @ chunk-FPEHBWIL.js?v=a329eec5:19169 performConcurrentWorkOnRoot @ chunk-FPEHBWIL.js?v=a329eec5:18728 workLoop @ chunk-FPEHBWIL.js?v=a329eec5:197 flushWork @ chunk-FPEHBWIL.js?v=a329eec5:176 performWorkUntilDeadline @ chunk-FPEHBWIL.js?v=a329eec5:384Understand this errorAI index.js:213 Warning: Each child in a list should have a unique "key" prop. Check the render method of `BetaSlots`. See https://reactjs.org/link/warning-keys for more information. at SpotItem (https://localhost.chasiwu-sit.chaspark.cn:8087/src/h5/components/FilterList/modules/SportingEventItem/index.js?t=1764145480809:13:5) at BetaSlots (https://localhost.chasiwu-sit.chaspark.cn:8087/src/h5/routes/contest/home/modules/BetaSlots/index.js?t=1764148443052:47:5) at div at div at div at https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/antd-mobile.js?v=a329eec5:1859:50 at PullToRefresh (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/antd-mobile.js?v=a329eec5:16309:7) at div at Content (https://localhost.chasiwu-sit.chaspark.cn:8087/src/h5/routes/home/modules/Content/index.js?t=1764145480809:14:5) at div at window.$RefreshReg$ (https://localhost.chasiwu-sit.chaspark.cn:8087/src/h5/routes/home/modules/Layouts/index.js?t=1764214325461:19:20) at default (https://localhost.chasiwu-sit.chaspark.cn:8087/src/h5/routes/contest/home/index.js?t=1764214325461:17:41) at div at Suspense at Layouts (https://localhost.chasiwu-sit.chaspark.cn:8087/src/h5/components/Layouts/index.js?t=1764215092864:71:5) at https://localhost.chasiwu-sit.chaspark.cn:8087/src/h5/routes/loader.js?t=1764215092864:15:22 at Updatable2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:885:9) at Suspender2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:792:9) at Suspense at Freeze (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:824:26) at DelayFreeze2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:844:9) at Updatable$1 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:904:26) at div at CacheComponent2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:587:9) at Route2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/chunk-R4H6Z5XC.js?v=a329eec5:1017:33) at CacheRoute2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:917:9) at https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:1046:31 at Updatable2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:885:9) at Suspender2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:792:9) at Suspense at Freeze (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:824:26) at DelayFreeze2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:844:9) at Updatable$1 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:904:26) at CacheSwitch2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-router-cache-route.js?v=a329eec5:1077:9) at C2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/chunk-R4H6Z5XC.js?v=a329eec5:792:37) at DataProvider (https://localhost.chasiwu-sit.chaspark.cn:8087/src/h5/Contexts/DataContext.js:7:3) at default (https://localhost.chasiwu-sit.chaspark.cn:8087/src/h5/routes/index.js?t=1764215092864:14:16) at Suspense at Switch2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/chunk-R4H6Z5XC.js?v=a329eec5:1131:33) at Router2 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/chunk-R4H6Z5XC.js?v=a329eec5:875:34) at Provider (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-redux.js?v=a329eec5:918:3) at ConfigProvider (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/antd-mobile.js?v=a329eec5:489:5) at IntlProvider3 (https://localhost.chasiwu-sit.chaspark.cn:8087/node_modules/.vite/deps/react-intl.js?v=a329eec5:4204:45) at AppH5 at Suspense printWarning @ react_jsx-dev-runtime.js?v=a329eec5:64 error @ react_jsx-dev-runtime.js?v=a329eec5:48 validateExplicitKey @ react_jsx-dev-runtime.js?v=a329eec5:724 validateChildKeys @ react_jsx-dev-runtime.js?v=a329eec5:737 jsxWithValidation @ react_jsx-dev-runtime.js?v=a329eec5:855 BetaSlots @ index.js:213 renderWithHooks @ chunk-FPEHBWIL.js?v=a329eec5:11596 updateFunctionComponent @ chunk-FPEHBWIL.js?v=a329eec5:14630 beginWork @ chunk-FPEHBWIL.js?v=a329eec5:15972 beginWork$1 @ chunk-FPEHBWIL.js?v=a329eec5:19806 performUnitOfWork @ chunk-FPEHBWIL.js?v=a329eec5:19251 workLoopSync @ chunk-FPEHBWIL.js?v=a329eec5:19190 renderRootSync @ chunk-FPEHBWIL.js?v=a329eec5:19169 performConcurrentWorkOnRoot @ chunk-FPEHBWIL.js?v=a329eec5:18728 workLoop @ chunk-FPEHBWIL.js?v=a329eec5:197 flushWork @ chunk-FPEHBWIL.js?v=a329eec5:176 performWorkUntilDeadline @ chunk-FPEHBWIL.js?v=a329eec5:384Understand this errorAI :8087/#/races:1 Access to fetch at 'https://gray.chaspark.net/chasiwu/media/v1/tinyimage/1140494973038608384.jpg?_t=1764224204789&lang=zh' from origin 'https://localhost.chasiwu-sit.chaspark.cn:8087' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.Understand this errorAI gray.chaspark.net/chasiwu/media/v1/tinyimage/1140494973038608384.jpg?_t=1764224204789&lang=zh:1 GET https://gray.chaspark.net/chasiwu/media/v1/tinyimage/1140494973038608384.jpg?_t=1764224204789&lang=zh net::ERR_FAILED Promise.then (anonymous) @ chunk-VSIV6B2H.js?v=a329eec5:89 execute @ chunk-VSIV6B2H.js?v=a329eec5:87 send @ fetch.js:178 (anonymous) @ fetch.js:204 img.onload @ utils.js:137Understand this errorAI utils.js:123 Uncaught (in promise) TypeError: Failed to fetch Promise.then (anonymous) @ chunk-VSIV6B2H.js?v=a329eec5:89 execute @ chunk-VSIV6B2H.js?v=a329eec5:87 send @ fetch.js:178 (anonymous) @ fetch.js:204 img.onload @ utils.js:137Understand this errorAI 你看看是否有
最新发布
11-28
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值