小程序使用canvas生成二维码


小程序生成二维码
weapp.qrcode.min.js放在小程序根目录下
在需要的页面的js中引入var qrcode = require('../../weapp.qrcode.min.js');
页面js:
qrcode({
  width:100,
  height:100,
  canvasId:'myQrcode',
  text:"123",//二维码内容
  callback:function(){}
});
页面canvas:
<view>
  <canvas style="width:{{windowWidth*0.5}}px;height:{{windowWidth*0.5}}px;margin:0 auto;" canvas-id="myQrcode"></canvas>
</view>
windowWidth手机屏幕大小,通过wx.getSystemInfo获取
data:{
  windowWidth:0,
},
wx.getSystemInfo({
  success:(res)=>{
    that.windowWidth:res.windowWidth,
  }
})

 

抱歉,小程序舒适不会,知道啥记录点啥把...


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM