小程序售票--购票后生成二维码

先到   https://github.com/davidshimjs/qrcodejs 下载一个 weapp-qrcode.js

 

然后放在utils文件夹下

在要生成二维码的页面js最上面导入该js

var QRCode = require('../../utils/weapp-qrcode.js')
var qrcode;
 
js代码:
qrcode = new QRCode('canvas', {
      
    
      // usingIn: this,
      text: "你要生成的内容",
      width: 250,
      height: 250,
      colorDark: "black",
      colorLight: "white",
      correctLevel: QRCode.CorrectLevel.H

    });

wxml代码:

<canvas  class='canvas' canvas-id='canvas' bindlongtap='save'></canvas>

 

 

posted @ 2018-11-07 16:01  Hiro-D  阅读(891)  评论(0编辑  收藏  举报