From ee5c93ce76a193d6f8b416de28d124793b4239c4 Mon Sep 17 00:00:00 2001 From: chenwenhao Date: Tue, 29 Oct 2024 15:24:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20#11128=20dialog=E5=8A=A8=E4=BD=9C?= =?UTF-8?q?=E7=9A=84data=E6=94=AF=E6=8C=81dataMergeData=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-core/src/store/iRenderer.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/amis-core/src/store/iRenderer.ts b/packages/amis-core/src/store/iRenderer.ts index 741660fd782..6725d513bf5 100644 --- a/packages/amis-core/src/store/iRenderer.ts +++ b/packages/amis-core/src/store/iRenderer.ts @@ -253,7 +253,12 @@ export const iRendererStore = StoreNode.named('iRendererStore') } const data = createObjectFromChain(chain); - const mappingData = self.action.data ?? self.action.dialog?.data; + const dataMergeMode = self.action.dataMergeMode || 'merge'; + // 当配置了 data 的时候,可以控制数据追加方式,支持合并(merge)和覆盖(override)两种模式 + const mappingData = + dataMergeMode === 'override' + ? self.action.data ?? self.action.dialog?.data + : {...self.action.data, ...self.action.dialog?.data}; if (mappingData) { self.dialogData = createObjectFromChain([ top?.context,