From 66766197a4351a71114c6d0c1dc5d9946fe87b81 Mon Sep 17 00:00:00 2001 From: YoYo Date: Wed, 8 Apr 2026 20:07:13 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BE=93=E5=85=A5=E6=A1=86=20Enter=20?= =?UTF-8?q?=E9=94=AE=E5=BF=BD=E7=95=A5=20IME=20=E8=BE=93=E5=85=A5=E6=B3=95?= =?UTF-8?q?=E5=90=88=E5=AD=97=E9=98=B6=E6=AE=B5=EF=BC=8C=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E8=AF=AF=E8=A7=A6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 中文输入法在选字时按回车,会触发 keydown.enter 事件, 但此时 v-model 尚未更新(组合阶段未结束),导致 inputValue 仍为空字符串,造成 saveToDiary 的 if (!name) return 分支被触发,配方从未保存,「我的配方」中自然看不到。 修复方案: - 监听 compositionstart / compositionend 事件, 用 isComposing 标记组合状态 - compositionend 时手动同步 inputValue(确保值最新) - submitPrompt 检查 e.isComposing || isComposing.value, 任一为真则跳过提交,等用户真正按下独立 Enter 再确认 Co-Authored-By: YoYo --- frontend/src/components/CustomDialog.vue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/CustomDialog.vue b/frontend/src/components/CustomDialog.vue index c3a28c9..a34349a 100644 --- a/frontend/src/components/CustomDialog.vue +++ b/frontend/src/components/CustomDialog.vue @@ -8,6 +8,8 @@ type="text" style="width:100%;padding:10px 14px;border:1.5px solid #d4cfc7;border-radius:10px;font-size:14px;margin-bottom:16px;outline:none;font-family:inherit;box-sizing:border-box" @keydown.enter="submitPrompt" + @compositionstart="isComposing = true" + @compositionend="onCompositionEnd" ref="promptInput" />
@@ -19,11 +21,12 @@