From 66e98219bcac1af4d9bf684cc31af330c68b679a Mon Sep 17 00:00:00 2001
From: YFeng <499756901@qq.com>
Date: Wed, 28 Feb 2024 10:16:19 +0800
Subject: [PATCH] 提供签名组件的显示兼容性

---
 forms/userSignature/CSignatureLayer.vue |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/forms/userSignature/CSignatureLayer.vue b/forms/userSignature/CSignatureLayer.vue
index 23f6766..1deac9d 100644
--- a/forms/userSignature/CSignatureLayer.vue
+++ b/forms/userSignature/CSignatureLayer.vue
@@ -73,7 +73,16 @@
         };
     },
     methods: {
+        _initDraw() {
+            this.canvasContext = Taro.createCanvasContext(this.cavId, this);
+            const $container = $(this.$refs.drawing).parent();
+            setTimeout(() => {
+                $container.width().then(w => (this.cavWidth = w));
+                $container.height().then(h => (this.cavHeight = h));
+            }, 0);
+        },
         $onDraw(callback) {
+            this._initDraw();
             this.layerOpened = true;
             this._callback = callback;
             this.handleRestDraw();
@@ -420,12 +429,7 @@
     },
     mounted() {
         this.$nextTick(() => {
-            this.canvasContext = Taro.createCanvasContext(this.cavId, this);
-            const $container = $(this.$refs.drawing).parent();
-            setTimeout(() => {
-                $container.width().then(w => (this.cavWidth = w));
-                $container.height().then(h => (this.cavHeight = h));
-            }, 0);
+            this._initDraw();
         });
     },
 };

--
Gitblit v1.9.1