From d16e6a869e05d8d942bf0d1edfe97ca6a9fb063d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=83=E5=B2=9A=E4=B9=8B=E5=A4=8F?= <108566281+Blueteemo@users.noreply.github.com> Date: Fri, 29 May 2026 13:03:56 +0800 Subject: [PATCH] fix: Dashboard list config item cannot input spaces (#8403) * fix: Dashboard list config item cannot input spaces (#8393) * docs: add comment clarifying pure-space filtering in watch is expected behavior --- dashboard/src/components/shared/ListConfigItem.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dashboard/src/components/shared/ListConfigItem.vue b/dashboard/src/components/shared/ListConfigItem.vue index be81255af..caa2f96a8 100644 --- a/dashboard/src/components/shared/ListConfigItem.vue +++ b/dashboard/src/components/shared/ListConfigItem.vue @@ -205,8 +205,9 @@ const isSingleItemMode = computed(() => (props.modelValue?.length ?? 0) <= 1 && const singleItemValue = computed({ get: () => props.modelValue?.[0] ?? '', set: (value) => { - // 如果值为空或只有空白字符,emit 空数组 - if (value.trim() === '') { + // 仅当值为完全空字符串(未输入任何字符)时清空数组, + // 允许包含空格(如 "hello world")以及纯空格(如 " ")通过 + if (value === '') { emit('update:modelValue', []) return } @@ -241,7 +242,7 @@ const batchImportPreviewCount = computed(() => { watch(() => props.modelValue, (newValue) => { localItems.value = [...(newValue || [])] - // 自动清理只包含空字符串的数组 + // 自动清理只包含空字符串或纯空格的条目(纯空格在配置中无意义,此过滤为预期兜底行为) if (newValue && newValue.length > 0) { const filtered = newValue.filter(item => typeof item === 'string' ? item.trim() !== '' : true) if (filtered.length !== newValue.length) {