如果是uniapp的话,uni.canvasToTempFilePath的第二个参数增加this,例如:
uni.canvasToTempFilePath({ x: 100, y: 200, width: 50, height: 50, destWidth: 100, destHeight: 100, canvasId: 'myCanvas', success: function(res) { // 在H5平台下,tempFilePath 为 base64 console.log(res.tempFilePath) } },this)
网友回复