Browse Source

fix(signature): 在“微信小程序”中点确认后保存的图片无法打开查看签名图片 #829 (#830)

Co-authored-by: TangYang <tangyang100>
muitang 4 years ago
parent
commit
778e5166e6
1 changed files with 16 additions and 8 deletions
  1. 16 8
      src/packages/__VUE/signature/index.taro.vue

+ 16 - 8
src/packages/__VUE/signature/index.taro.vue

@@ -107,15 +107,23 @@ export default create({
       if (!state.canvas) {
         return;
       }
-      Taro.canvasToTempFilePath({
-        canvas: state.canvas,
-        fileType: props.type
-      })
-        .then((res) => {
-          emit('confirm', res.tempFilePath);
+      Taro.createSelectorQuery()
+        .select("#spcanvas")
+        .fields({
+          node: true,
+          size: true,
         })
-        .catch((e) => {
-          emit('confirm', e);
+        .exec(async (res) => {
+          Taro.canvasToTempFilePath({
+            canvas: res[0].node,
+            fileType: props.type,
+          })
+            .then((res) => {
+              emit("confirm", res.tempFilePath);
+            })
+            .catch((e) => {
+              emit("confirm", e);
+            });
         });
     };