From 16c3f89873ca867213d0fef12a8de115d7cc7de3 Mon Sep 17 00:00:00 2001 From: liaoxuezhi <2betop.cn@gmail.com> Date: Tue, 13 Sep 2022 11:16:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=8D=E8=A6=81=E9=80=9A=E8=BF=87=20i?= =?UTF-8?q?sEqual=20=E5=8E=BB=E6=AF=94=E5=AF=B9=20props.data=20=E9=87=8C?= =?UTF-8?q?=E9=9D=A2=E5=8F=AF=E8=83=BD=E5=AD=98=E5=9C=A8=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E5=AF=BC=E8=87=B4=E6=AD=BB=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=20(#5353)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-core/src/renderers/wrapControl.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/amis-core/src/renderers/wrapControl.tsx b/packages/amis-core/src/renderers/wrapControl.tsx index deafadf85..623d93cea 100644 --- a/packages/amis-core/src/renderers/wrapControl.tsx +++ b/packages/amis-core/src/renderers/wrapControl.tsx @@ -354,8 +354,12 @@ export function wrapControl< // 渲染器中的 defaultValue 优先(备注: SchemaRenderer中会将 value 改成 defaultValue) if ( !isEqual(props.defaultValue, prevProps.defaultValue) || - (!isEqual(props.data, prevProps.data) && - isNeedFormula(props.defaultValue, props.data, prevProps.data)) + (isNeedFormula( + props.defaultValue, + props.data, + prevProps.data + ) && + props.data !== prevProps.data) ) { const curResult = FormulaExec['formula']( props.defaultValue, @@ -383,7 +387,7 @@ export function wrapControl< // value 非公式表达式时,name 值优先,若 defaultValue 主动变动时,则使用 defaultValue if ( // 然后才是查看关联的 name 属性值是否变化 - !isEqual(props.data, prevProps.data) && + props.data !== prevProps.data && (!model.emitedValue || isEqual(model.emitedValue, model.tmpValue)) ) {