const qrcode = require('../../lib/qrcode.js')

Page({

  /**
   * 页面的初始数据
   */
  data: {
    carCode:''
  },
  onLoad: function (options) {
    let size = this.setCanvasSize();//动态设置画布大小
    qrcode.draw(options.vcu, 'qrcCanvas', size.w, size.h); 
  },
  backList(){
    wx.navigateBack()
  },
  //适配不同屏幕大小的canvas  
  setCanvasSize: function () {
    var size = {};
    try {
      var res = wx.getSystemInfoSync();
      var scale = 750 / 500;//不同屏幕下canvas的适配比例；设计稿是750宽  
      var width = res.windowWidth / scale;
      var height = width;//canvas画布为正方形  
      size.w = width;
      size.h = height;
    } catch (e) {
      // Do something when catch error  
      console.log("获取设备信息失败" + e);
    }
    return size;
  },  
})