From 456b21846e549dcfed9524d1c8325c44ec6afafe Mon Sep 17 00:00:00 2001
From: YFeng <499756901@qq.com>
Date: Tue, 27 Feb 2024 18:34:38 +0800
Subject: [PATCH] 实现小程序中签名

---
 forms/input/CInput.vue |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/forms/input/CInput.vue b/forms/input/CInput.vue
index d23c616..211d760 100644
--- a/forms/input/CInput.vue
+++ b/forms/input/CInput.vue
@@ -6,7 +6,7 @@
 <template>
     <view
         class="c-input"
-        :class="[unit?'c-input-unit':'', readOnly ? 'read-only':'']"
+        :class="[unit?'c-input-unit':'', readOnly?'read-only':'']"
     >
         <AtInput
             :name="itemRes.name"
@@ -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