From 9ab038ff4cce6095c112378109c71bc706b9a702 Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Fri, 18 Aug 2023 10:06:50 +0800
Subject: [PATCH] 修复使用新模式后,地址电话地区码获取不正常的问题

---
 forms/input/CInput.vue |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/forms/input/CInput.vue b/forms/input/CInput.vue
index d23c616..5d01979 100644
--- a/forms/input/CInput.vue
+++ b/forms/input/CInput.vue
@@ -17,7 +17,7 @@
             :error="itemRes.error"
             :cursorSpacing="0"
             :value="value"
-            :onChange="evt => hanldeChange(evt)"
+            :onChange="evt => handleChange(evt)"
         >
             <slot v-if="!unit" />
             <text
@@ -61,9 +61,11 @@
         },
     },
     methods: {
-        hanldeChange(evt) {
-            // 小程序中,可以粘贴换行符进来
-            const changeValue = ((evt || '') + '').replace(/[\n\r]/g, '');
+        handleChange(evt) {
+            // 去除首尾空格,小程序中还可以粘贴换行符进来
+            const changeValue = ((evt || '') + '')
+                .replace(/^\s+|\s+$/g, '')
+                .replace(/[\n\r\t]/g, '');
             this.itemRes.onChange(changeValue);
         },
     },

--
Gitblit v1.9.1