From e7345b75cdfe8e4be6acdc4911d434c90c48a291 Mon Sep 17 00:00:00 2001 From: 18631081161 <2088094923@qq.com> Date: Wed, 25 Mar 2026 17:35:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniapp/pages/profile/edit.vue | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/miniapp/pages/profile/edit.vue b/miniapp/pages/profile/edit.vue index 626b83c..b2cfdcd 100644 --- a/miniapp/pages/profile/edit.vue +++ b/miniapp/pages/profile/edit.vue @@ -104,8 +104,9 @@ @@ -1119,12 +1120,28 @@ const handleExpectMarryChange = (e) => { } const handleSurnameBlur = () => { + // 姓氏超过2个字时截断 + if (formData.surname.length > 2) { + formData.surname = formData.surname.slice(0, 2) + } // 姓氏输入完成后触发昵称生成 if (formData.relationship && formData.surname) { formData.nickname = generateNickname(formData.relationship, formData.surname, formData.childGender || 1) } } +/** + * 姓氏输入事件 - 在中文输入法确认后限制长度 + * iOS中文输入法拼音组合阶段不截断,只在确认汉字后检查 + */ +const handleSurnameInput = (e) => { + const value = e.detail.value || '' + // 只在确认的文字超过2个字符时截断 + if (value.length > 2) { + formData.surname = value.slice(0, 2) + } +} + // 择偶要求处理 const handleAgeMinChange = (e) => { const val = ageRangeOptions.value[e.detail.value]