微信小程序组件内(component)canvas元素的坑 canvasToTempFilePath: fail canvas is empty
痴心阿文:
let that = this
ctx.draw(true, (()=> {
console.log("this.canvasStyle", that.canvasStyle)
uni.canvasToTempFilePath({
canvasId: 'confirmBillDetail',
destWidth: 2479,
destHeight: 3508,
success: (res)=> {
// 在H5平台下,tempFilePath 为 base64
console.log('生成的路径', res.tempFilePath)
uni.uploadFile({
url: that.$url.upload,
filePath: res.tempFilePath,
name: 'file',
header: {
token: that.$store.state.token,
version: '10.00.0'
},
success: (res)=>{
console.log("resshangchuanchenggong", JSON.parse(res.data).url)
console.log("that.useHeight", that.useHeight)
that.$emit('detailUrl', {url:JSON.parse(res.data).url, goodsLength: that.goodsList.length})
},
fail: (res)=> {
console.log("shangchuanshibai", res)
}
})
},
fail: (res)=>{
console.log("失败了", res)
},
complete: (res)=> {
conso
|