Skip to content

Commit d16e6a8

Browse files
authored
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
1 parent cea3770 commit d16e6a8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

dashboard/src/components/shared/ListConfigItem.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,9 @@ const isSingleItemMode = computed(() => (props.modelValue?.length ?? 0) <= 1 &&
205205
const singleItemValue = computed({
206206
get: () => props.modelValue?.[0] ?? '',
207207
set: (value) => {
208-
// 如果值为空或只有空白字符,emit 空数组
209-
if (value.trim() === '') {
208+
// 仅当值为完全空字符串(未输入任何字符)时清空数组,
209+
// 允许包含空格(如 "hello world")以及纯空格(如 " ")通过
210+
if (value === '') {
210211
emit('update:modelValue', [])
211212
return
212213
}
@@ -241,7 +242,7 @@ const batchImportPreviewCount = computed(() => {
241242
watch(() => props.modelValue, (newValue) => {
242243
localItems.value = [...(newValue || [])]
243244
244-
// 自动清理只包含空字符串的数组
245+
// 自动清理只包含空字符串或纯空格的条目(纯空格在配置中无意义,此过滤为预期兜底行为)
245246
if (newValue && newValue.length > 0) {
246247
const filtered = newValue.filter(item => typeof item === 'string' ? item.trim() !== '' : true)
247248
if (filtered.length !== newValue.length) {

0 commit comments

Comments
 (0)