From 6bda32964d457264766ef1f9ade1d77584c5c622 Mon Sep 17 00:00:00 2001 From: Janry Date: Sat, 4 Jul 2020 15:51:09 +0800 Subject: [PATCH] fix(core): fix antd table get row key (#946) --- packages/antd-components/src/array-table/index.tsx | 5 +++-- packages/core/src/models/field.ts | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/antd-components/src/array-table/index.tsx b/packages/antd-components/src/array-table/index.tsx index 07229fbe8c8..1d227e7c595 100644 --- a/packages/antd-components/src/array-table/index.tsx +++ b/packages/antd-components/src/array-table/index.tsx @@ -143,11 +143,12 @@ export const ArrayTable: any = styled( }) } const renderTable = () => { - let index = 0 return ( index++} + rowKey={record => { + return toArr(value).indexOf(record) + }} pagination={false} columns={columns} dataSource={toArr(value)} diff --git a/packages/core/src/models/field.ts b/packages/core/src/models/field.ts index d8be2f91c6a..6e1627924b6 100644 --- a/packages/core/src/models/field.ts +++ b/packages/core/src/models/field.ts @@ -296,11 +296,9 @@ export const Field = createModel( draft.value = undefined draft.values = toArr(draft.values) draft.values[0] = undefined - this.updates.push('value') } else if (draft.visible === true) { if (!isValid(draft.value)) { draft.value = draft.visibleCacheValue - this.updates.push('value') } } }