浏览代码

二维码

1
mo 3 年之前
父节点
当前提交
b8580b3555
共有 1 个文件被更改,包括 12 次插入6 次删除
  1. 12 6
      src/components/QrCode/index.vue

+ 12 - 6
src/components/QrCode/index.vue

@@ -126,11 +126,12 @@ export default {
       if (newValue) {
         const image = new Image();
         image.src = this.logo;
-        image.width=58
-        image.height=58
+        image.width = 58;
+        image.height = 58;
         image.onload = () => {
           const canvas = qrcanvas({
-            cellSize:5,
+            options: { w: 281, h: 281 },
+            cellSize: 5,
             data: this.codeUrl,
             padding: 8,
             logo: {
@@ -141,10 +142,9 @@ export default {
         };
       } else {
         let firstDoc = document.getElementById("preview").firstChild;
-        if(firstDoc){
-           document.getElementById("preview").removeChild(firstDoc);
+        if (firstDoc) {
+          document.getElementById("preview").removeChild(firstDoc);
         }
-
       }
     },
     title(newValue, oldValue) {
@@ -169,4 +169,10 @@ export default {
     }
   }
 }
+#preview {
+  canvas {
+    width: 281px!important;
+    height: 281px!important;
+  }
+}
 </style>