From c0d41bba5c25a842842301d3ff5f5258fd38ef7f Mon Sep 17 00:00:00 2001 From: ranqirong <274544338@qq.com> Date: Tue, 7 Jan 2025 16:17:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(amis):=20table=E5=B5=8C=E5=A5=97=E5=9C=A8cr?= =?UTF-8?q?ud=E4=B8=8B=E9=9D=A2=EF=BC=8CsetValue=E6=97=B6=E9=80=9A?= =?UTF-8?q?=E8=BF=87crud=E8=BF=9B=E8=A1=8C=E6=93=8D=E4=BD=9C=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3crud=E7=9A=84setValue=E5=8A=A8=E4=BD=9C?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #11453 --- packages/amis/src/renderers/Table/index.tsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/amis/src/renderers/Table/index.tsx b/packages/amis/src/renderers/Table/index.tsx index 445dee30272..2a42fefecb8 100644 --- a/packages/amis/src/renderers/Table/index.tsx +++ b/packages/amis/src/renderers/Table/index.tsx @@ -3047,7 +3047,7 @@ export class TableRendererBase extends Table { index?: number | string, condition?: any ) { - const {store} = this.props; + const {store, host} = this.props; if (index !== undefined || condition !== undefined) { const targets = await this.getEventTargets( @@ -3058,13 +3058,19 @@ export class TableRendererBase extends Table { targets.forEach(target => { target.updateData(values); }); - } else { - const data = { - ...values, - rows: values.rows ?? values.items // 做个兼容 - }; - return store.updateData(data, undefined, replace); + return; } + + if (host) { + host.setData?.(values, replace); + } + + const data = { + ...values, + rows: values.rows ?? values.items // 做个兼容 + }; + + return store.updateData(data, undefined, replace); } getData() {