Commit 26f251e1ed5bfd79c8615fb552ca302f917cc588

Authored by 无木
1 parent 1214b7c3

fix(qrcode): qrcode not displayed properly

fixed: #1026
src/components/Qrcode/src/Qrcode.vue
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 </div> 4 </div>
5 </template> 5 </template>
6 <script lang="ts"> 6 <script lang="ts">
7 - import { defineComponent, watch, PropType, ref, unref } from 'vue'; 7 + import { defineComponent, watch, PropType, ref, unref, onMounted } from 'vue';
8 import { toCanvas, QRCodeRenderersOptions, LogoType } from './qrcodePlus'; 8 import { toCanvas, QRCodeRenderersOptions, LogoType } from './qrcodePlus';
9 import { toDataURL } from 'qrcode'; 9 import { toDataURL } from 'qrcode';
10 import { downloadByUrl } from '/@/utils/file/download'; 10 import { downloadByUrl } from '/@/utils/file/download';
@@ -93,16 +93,18 @@ @@ -93,16 +93,18 @@
93 }); 93 });
94 } 94 }
95 95
  96 + onMounted(createQrcode);
  97 +
96 // 监听参数变化重新生成二维码 98 // 监听参数变化重新生成二维码
97 watch( 99 watch(
98 props, 100 props,
99 () => { 101 () => {
100 - createQrcode() 102 + createQrcode();
101 }, 103 },
102 { 104 {
103 deep: true, 105 deep: true,
104 } 106 }
105 - ) 107 + );
106 108
107 return { wrapRef, download }; 109 return { wrapRef, download };
108 }, 110 },