麻烦大佬们看看哪里有问题?canvas打印都没有
发布于 6 年前 作者 wei05 1626 次浏览 来自 问答

uploadImgs: function () {

var that = this

wx.chooseImage({

count: 1

sourceType: ['album', 'camera'],

sizeType: ['compressed'],

success: function (res) {

let tu1 = res.tempFilePaths[0];

wx.getImageInfo({

src: res.tempFilePaths[0],

success(res) {

let imgurl=res.path

let imgwidth=res.width;

let imgheight = res.height;

let destHeight=180

let destWidth = imgwidth * 180 / imgheight

var canvas = wx.createCanvasContext('card');

canvas.drawImage(imgurl, 0, 0, destWidth, destHeight);

canvas.draw(false,setTimeout(function () {

wx.canvasToTempFilePath({

canvasId: 'card'

succes: function (res) {

console.log('canvas-res', res)

2 回复

在每一层的success回调里打印一下res参数,看看哪一步出问题了,你要先确保前面的逻辑全部正常执行,再看是不是canvas不能打印

回到顶部