瀏覽代碼

fix(qrcode): qrcode not displayed properly

fixed: #1026
无木 3 年之前
父節點
當前提交
26f251e1ed
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/components/Qrcode/src/Qrcode.vue

+ 5 - 3
src/components/Qrcode/src/Qrcode.vue

@@ -4,7 +4,7 @@
   </div>
 </template>
 <script lang="ts">
-  import { defineComponent, watch, PropType, ref, unref } from 'vue';
+  import { defineComponent, watch, PropType, ref, unref, onMounted } from 'vue';
   import { toCanvas, QRCodeRenderersOptions, LogoType } from './qrcodePlus';
   import { toDataURL } from 'qrcode';
   import { downloadByUrl } from '/@/utils/file/download';
@@ -93,16 +93,18 @@
         });
       }
 
+      onMounted(createQrcode);
+
       // 监听参数变化重新生成二维码
       watch(
         props,
         () => {
-          createQrcode()
+          createQrcode();
         },
         {
           deep: true,
         }
-      )
+      );
 
       return { wrapRef, download };
     },