From ef7f8f7329fab93f7a398618c488277a4bf3272f Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Wed, 22 Mar 2023 09:52:20 +0800
Subject: [PATCH] 取消关闭mock功能,所有mock走get,图片上传可以单独改地址走post

---
 plugins/qrcode/CQRCode.vue |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/plugins/qrcode/CQRCode.vue b/plugins/qrcode/CQRCode.vue
index ef9fe4a..8acaae5 100644
--- a/plugins/qrcode/CQRCode.vue
+++ b/plugins/qrcode/CQRCode.vue
@@ -33,7 +33,9 @@
         },
     },
     data() {
-        return {};
+        return {
+            lastContent: '',
+        };
     },
     methods: {
         _renderQRCode(canvasDom) {
@@ -58,9 +60,14 @@
             const canvasBox = $(this.$refs.canvas.$el);
             const finderTimer = setInterval(() => {
                 const canvasDom = canvasBox.find('canvas');
-                if (canvasDom.length > 0) {
-                    this._renderQRCode(canvasDom[0]);
+                if (canvasDom.length === 0) {
+                    return;
                 }
+                if (this.lastContent === this.content) {
+                    return;
+                }
+                this._renderQRCode(canvasDom[0]);
+                this.lastContent = this.content;
             }, 10);
         } else {
             // TODO: 小程序中获取canvas

--
Gitblit v1.9.1