1016553998@qq.com
1016553998@qq.com
  • 发布:2021-04-12 17:08
  • 更新:2021-04-12 17:08
  • 阅读:26

IOS中uni.canvasToTempFilePath返回res.tempFilePath为空

分类:uni-app

在IOS中调用uni.canvasToTempFilePath,返回成功,但是里面的res.tempFilePath为空,在安卓机型里面可以返回BASE64的图片

        ecgline(){  
            let lineWidth = (1200/6)/250  
            let lineheight = 4800/15  
            let ctx = uni.createCanvasContext('ecgmap',this)  
            ctx.setLineWidth(1.5)  
            for (let i = 0; i < this.ecgmap.length; i++) {  
                let ypath = parseInt(i/(250*6))   
                let x = i%(250*6)*lineWidth  
                let y = -this.ecgmap[i]*100+lineheight*ypath+((4800/15)/8)*4  
                if(i%(250*6) == 0){  
                    ctx.moveTo(x, y)  
                }else{  
                    ctx.lineTo(x, y)  
                }  
            }  
            ctx.stroke()  
            ctx.draw(true,(()=>{  
                setTimeout(this.saveimg(),200)  
            }))  

        },  
         saveimg(){  
            console.log('保存图片')  
            let that = this  
            uni.canvasToTempFilePath({  
              canvasId: 'ecgmap',  
              fileType:'jpg',  
              success: function(res) {  
                that.img = res.tempFilePath  
              }   
            })  
        },  

该问题仅在IOS机型,真机运行才会出现,浏览器调试则为正常情况

2021-04-12 17:08 负责人:无 分享
已邀请:

要回复问题请先登录注册