首页 > 微信 > 详细

微信小程序中生成二维码

时间:2020-05-06 22:05:45      阅读:64      评论:0      收藏:0      [点我收藏+]

使用weapp-qrcode.js

链接:https://pan.baidu.com/s/1j0qjoYvl6pCK8EzSsfks9g 提取码:8wxe

<canvas class="canvas-code" canvas-id="myQrcode" :style="{ width: qrcode_w + ‘px‘, height: qrcode_w + ‘px‘ }" />

import QRCode from ‘../../utils/weapp-qrcode.js‘;

getEwm() {
			const W = wx.getSystemInfoSync().windowWidth;
			const rate = 750.0 / W;
			// 160rpx 在6s上为 80px
			this.qrcode_w = 160 / rate;
			new QRCode(‘myQrcode‘, {
				text: ‘你的链接‘,
				width: this.qrcode_w,
				height: this.qrcode_w,
				colorDark: ‘#000000‘,
				colorLight: ‘#ffffff‘,
				padding: 2, // 生成二维码四周自动留边宽度,不传入默认为0
				correctLevel: QRCode.CorrectLevel.L, // 二维码可辨识度
				callback: res => {
					console.log(res.path);
				}
			});
		}

  

微信小程序中生成二维码

原文:https://www.cnblogs.com/cheee/p/12837877.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!