From 1aea60d64276ab2b960e21ca3fc5716ff89dc7fe Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Thu, 30 Mar 2023 18:00:41 +0800
Subject: [PATCH] 优化跨端通讯协议,支持超时自动释放资源,支持异常通讯拦截

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

diff --git a/forms/input/CInput.vue b/forms/input/CInput.vue
index ca251f7..7c8d604 100644
--- a/forms/input/CInput.vue
+++ b/forms/input/CInput.vue
@@ -54,7 +54,7 @@
     },
     computed: {
         value() {
-            return (this.itemRes.formData[this.itemRes.name] || '').replace(
+            return ((this.itemRes.formData[this.itemRes.name] || '') + '').replace(
                 /[\n\r]/g,
                 ''
             );
@@ -62,8 +62,10 @@
     },
     methods: {
         hanldeChange(evt) {
-            // 小程序中,可以粘贴换行符进来
-            const changeValue = (evt || '').replace(/[\n\r]/g, '');
+            // 去除首尾空格,小程序中还可以粘贴换行符进来
+            const changeValue = ((evt || '') + '')
+                .replace(/^\s+|\s+$/g, '')
+                .replace(/[\n\r\t]/g, '');
             this.itemRes.onChange(changeValue);
         },
     },

--
Gitblit v1.9.1