使用 uni.getImageInfo({ }) 转化 将 图片地址转化成本地预览地址
initUrqCode(){// let logo = 'http://mujiachaoshi.kiss55.com/78aca7812fd801f8e6d4d4482af70d38'uni.getImageInfo({src: this.user.photo,success: (res) => {// 获取uQRCode实例var qr = new UQRCode();// 设置二维码内容qr.data = "1";// 设置二维码大小,必须与canvas设置的宽高一致qr.size = 200;qr.foregroundImageSrc = res.path;// qr.foregroundImageWidth = '50';// qr.foregroundImageHeight = '50';// qr.areaColor = 'rgba(255,255,255,0)';qr.areaColor = '#ffffff';// qr.foregroundImageBackgroundColor = '#eeffff';// qr.backgroundColor = 'rgba(0,0,0,0)'// qr.typeNumberBackgroundColor = 'rgba(0,0,0,0)'// 调用制作二维码方法qr.make();// 获取canvas上下文var canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件,this必须传入// 设置uQRCode实例的canvas上下文qr.canvasContext = canvasContext;// 调用绘制方法将二维码图案绘制到canvas上qr.drawCanvas();},fail: (err) => {console.log('图片加载失败', err);}});},