From b32a41151bb104341f0a80fe8c4e5cae943d888d Mon Sep 17 00:00:00 2001 From: smail Date: Tue, 8 Sep 2026 10:06:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=81=E4=B9=A6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E8=BE=93=E5=85=A5=E5=85=89=E6=A0=87=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ConfigSettings/ConfigField/ConfigField.js | 2 +- test/frontend/config-form.test.mjs | 2 ++ test/frontend/config-pagination.test.mjs | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/components/ConfigSettings/ConfigField/ConfigField.js b/frontend/src/views/components/ConfigSettings/ConfigField/ConfigField.js index 8cbd4174..e182673b 100644 --- a/frontend/src/views/components/ConfigSettings/ConfigField/ConfigField.js +++ b/frontend/src/views/components/ConfigSettings/ConfigField/ConfigField.js @@ -46,7 +46,7 @@ export function useField(props, emit) { watch(() => props.value, value => { const nextValue = typeof value === 'string' ? value : '' - if (!textEditing.value || nextValue !== textValue.value) { + if (!textEditing.value) { textValue.value = nextValue } }) diff --git a/test/frontend/config-form.test.mjs b/test/frontend/config-form.test.mjs index 1a125ad4..1e99701d 100644 --- a/test/frontend/config-form.test.mjs +++ b/test/frontend/config-form.test.mjs @@ -351,6 +351,8 @@ test('普通文本输入使用本地编辑值,父级配置刷新不会抢占 assert.match(script, /const textValue = ref\(/) assert.match(script, /const textEditing = ref\(false\)/) assert.match(script, /watch\(\(\) => props\.value/) + assert.match(script, /if \(!textEditing\.value\)\s*\{\s*textValue\.value = nextValue/) + assert.doesNotMatch(script, /!textEditing\.value \|\| nextValue !== textValue\.value/) }) test('统一加密方式同步切换 SMTP、IMAP、POP3 与已配置中继', () => { diff --git a/test/frontend/config-pagination.test.mjs b/test/frontend/config-pagination.test.mjs index ee41a1b6..26ffff37 100644 --- a/test/frontend/config-pagination.test.mjs +++ b/test/frontend/config-pagination.test.mjs @@ -43,8 +43,8 @@ test('网络和文本列表跨页编辑、添加、删除仅更新目标条目', const fieldSource = readFileSync(new URL('ConfigField/ConfigField.js', root), 'utf8') const useField = compileFunction( fieldSource.replace(/^import .*$/gm, '').replace(/^export \{.*$/gm, '').replace('export function', 'function') + '\nreturn useField', - ['computed', 'nextTick', 'fieldKey', 'usePagination'] - )(computed, nextTick, field => field.path.join('.'), usePagination) + ['computed', 'nextTick', 'ref', 'watch', 'fieldKey', 'usePagination'] + )(computed, nextTick, ref, watch, field => field.path.join('.'), usePagination) for (const type of ['list', 'network']) { const scope = effectScope() const value = ref(type === 'list' ? ['a.example', 'b.example', 'c.example'] : [