小程序使用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