fix(form): 对比模式下无 name 字段时不展示差异

避免 name 为空时拿整个 model/lastValues 做对比导致误判

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
roymondchen 2026-06-02 16:28:08 +08:00
parent 35fc394199
commit 64d35d5363

View File

@ -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') {