The issue is that the data is not being passed correctly to the dataSource prop of the EditableProTable component. To fix this, you can modify the useEffect hook to set the data for each dataSource key separately.\n\nHere's the updated code:\n\njsx\neffect(() => {\n const data = [\n {\n nodeVersion: '1',\n testingItem: '全功能用例测试',\n head: '张三',\n caseLibraryName: '222',\n },\n {\n nodeVersion: '2',\n testingItem: '全功能用例测试',\n head: '张三',\n caseLibraryName: '111',\n },\n ];\n\n const initialValues = {};\n DEMAND_DICT.forEach((item) => {\n initialValues[`dataSource${item.value}`] = data.map((item) => ({\n key: getOnlyKey(),\n ...item,\n }));\n });\n\n formRef.current?.setFieldsValue(initialValues);\n}, []);\n\n\nNote that we're creating an initialValues object to store the data for each dataSource key separately. We're also using the DEMAND_DICT array to iterate over each key and set the corresponding data.\n\nThis should ensure that the data is correctly passed to each EditableProTable component and displayed in the table.


原文地址: https://www.cveoy.top/t/topic/qfPb 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录