From d0ba3b58991e1be054a45ac914119916eb76c5fe Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Thu, 11 Nov 2021 11:22:50 +0800
Subject: [PATCH] 优化跨端通讯接收API

---
 common/BridgeTelling.js        |    4 ++++
 forms/input/CInputScanCode.vue |    4 +++-
 common/Bridge.js               |    1 -
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/common/Bridge.js b/common/Bridge.js
index 6664716..efc8eb3 100644
--- a/common/Bridge.js
+++ b/common/Bridge.js
@@ -151,7 +151,6 @@
                 // 有通知回调
                 if (marker) {
                     this._receives[method](param2, (param2) => {
-                        debugger;
                         this._sendTelling(method, param2 || {}, marker);
                     });
                 }
diff --git a/common/BridgeTelling.js b/common/BridgeTelling.js
index 3517b71..5218cf1 100644
--- a/common/BridgeTelling.js
+++ b/common/BridgeTelling.js
@@ -72,6 +72,10 @@
     }
 
     $pageBridge(page, method, res, callback) {
+        try {
+            res = typeof res === 'string' ? JSON.parse(res) : res;
+        } catch (e) {
+        }
         page.$component.$onBridge(method, res, callback);
     }
 
diff --git a/forms/input/CInputScanCode.vue b/forms/input/CInputScanCode.vue
index aac51ae..50ea652 100644
--- a/forms/input/CInputScanCode.vue
+++ b/forms/input/CInputScanCode.vue
@@ -101,7 +101,9 @@
                 if (this.onScaning) {
                     this.onScaning(res => {
                         this.scaning = false;
-                        this.itemRes.onChange(res.result);
+                        if (res.result) {
+                            this.itemRes.onChange(res.result);
+                        }
                     });
                 }
             }

--
Gitblit v1.9.1