Created
February 22, 2019 06:24
-
-
Save Houserqu/35867f0cb4f0f98fd7bc6ce82998d9d2 to your computer and use it in GitHub Desktop.
二维码生成组件-vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // <script src="./resources/js/qrcode.min.js"></script> | |
| // https://davidshimjs.github.io/qrcodejs/ | |
| Vue.component('qrcode', { | |
| props: ['value', 'id'], | |
| template: '<div id="id"></div>', | |
| mounted: function () { | |
| this.initQR() | |
| }, | |
| methods: { | |
| initQR: function () { | |
| this.qrcode = new QRCode(document.getElementById("id"), { width: 140, height: 140 }); | |
| this.qrcode.makeCode(this.value); | |
| } | |
| } | |
| }) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
基于 qrcode.js 库