vue-cli项目生成二维码功能使用QRCode

vue-cli项目生成二维码功能使用QRCode
vue-cli项目生成二维码功能使用QRCode_第1张图片
image.png

1安装.npm install --save qrcodejs2

2,在页面上引入

1.  import QRCode from 'qrcodejs2'  


1.  
二维码生成的位置
1. methods: { 2. qrcode () { 3. let qrcode = new QRCode('qrcode', { 4. width: 100, 5. height: 100, // 高度 [图片上传失败...(image-9ad77b-1525851843730)] 6. text: '588888888' // 二维码内容 7. // render: 'canvas' // 设置渲染方式(有两种方式 table和canvas,默认是canvas) 8. // background: '#f0f' 9. // foreground: '#ff0' 10. }) 11. console.log(qrcode) 12. } 13. }, 1. mounted () { //调用 2. this.qrcode() 3. }

你可能感兴趣的:(vue-cli项目生成二维码功能使用QRCode)