diff --git a/CHANGELOG.md b/CHANGELOG.md index b402c15cb8..f0a9c92255 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,7 @@ spline: explain - `steps`: 全局配置添加步骤条的已完成图标自定义 @Zzongke ([#2491](https://github.com/Tencent/tdesign-react/pull/2491)) - `Table`: 可筛选表格,`onFilterChange` 事件新增参数 `trigger: 'filter-change' | 'confirm' | 'reset' | 'clear'`,表示触发筛选条件变化的来源 @chaishi ([#2492](https://github.com/Tencent/tdesign-react/pull/2492)) - `Form`: trigger新增`submit`选项 @honkinglin ([#2507](https://github.com/Tencent/tdesign-react/pull/2507)) -- `ImageViewer`: - - `onIndexChange` 事件新增 `trigger` 枚举值 `current` @chaishi ([#2494](https://github.com/Tencent/tdesign-react/pull/2494)) - - +- `ImageViewer`: `onIndexChange` 事件新增 `trigger` 枚举值 `current` @chaishi ([#2494](https://github.com/Tencent/tdesign-react/pull/2494)) - `Image`: - 新增 `fallback`,表示图片的兜底图,原始图片加载失败时会显示兜底图 @chaishi ([#2494](https://github.com/Tencent/tdesign-react/pull/2494)) - 新增支持 `src` 类型为 `File`,支持通过 `File` 预览图片 @chaishi ([#2494](https://github.com/Tencent/tdesign-react/pull/2494)) diff --git a/src/form/hooks/useInstance.tsx b/src/form/hooks/useInstance.tsx index 21aea8697d..74123687c9 100644 --- a/src/form/hooks/useInstance.tsx +++ b/src/form/hooks/useInstance.tsx @@ -115,7 +115,8 @@ export default function useInstance(props: TdFormProps, formRef, formMapRef: Rea const fieldsValue = {}; if (nameList === true) { - for (const [name, formItemRef] of formMapRef.current.entries()) { + // 嵌套数组子节点先添加导致外层数据覆盖因而需要倒序遍历 + for (const [name, formItemRef] of [...formMapRef.current.entries()].reverse()) { const fieldValue = calcFieldValue(name, formItemRef?.current.getValue?.()); merge(fieldsValue, fieldValue); }