From 64d35d53631698e8d94362765a1621654bd3d1f6 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Tue, 2 Jun 2026 16:28:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(form):=20=E5=AF=B9=E6=AF=94=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E6=97=A0=20name=20=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E5=B1=95=E7=A4=BA=E5=B7=AE=E5=BC=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免 name 为空时拿整个 model/lastValues 做对比导致误判 Co-authored-by: Cursor --- packages/form/src/containers/Container.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/form/src/containers/Container.vue b/packages/form/src/containers/Container.vue index d545c5c1..3fc729c4 100644 --- a/packages/form/src/containers/Container.vue +++ b/packages/form/src/containers/Container.vue @@ -307,8 +307,10 @@ const name = computed(() => props.config.name || ''); // 便于业务侧自定义"语义上相等"的特殊场景(例如空字符串与空 hook 结构)。 const showDiff = computed(() => { if (!props.isCompare) return false; - const curValue = name.value ? props.model[name.value] : props.model; - const lastValue = name.value ? props.lastValues[name.value] : props.lastValues; + if (!name.value) return false; + + const curValue = props.model[name.value]; + const lastValue = props.lastValues[name.value]; const customShowDiff = diffConfig.showDiff; if (typeof customShowDiff === 'function') {