From f81a7a619725aa57c48353fca2c21a43fc3b7aee Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Wed, 06 Mar 2024 16:28:54 +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