Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CanvasContext.drawImage()报错问题 #4091

Closed
archerQ opened this issue Aug 6, 2019 · 7 comments
Closed

CanvasContext.drawImage()报错问题 #4091

archerQ opened this issue Aug 6, 2019 · 7 comments
Labels
T-h5 Target - 编译到 H5 V-2 Version - 2.x

Comments

@archerQ
Copy link

archerQ commented Aug 6, 2019

使用Canvas画图,代码大致如下:
let ctx = Taro.createCanvasContext('myCanvas', this) console.log('===图片信息==',images) let front = images.front console.log('==底图信息==', front) ctx.drawImage(front, 10, 10, 300, 400) ctx.draw()

其中front是下载下来的图片,格式为:
http://127.0.0.1:9091/f52be074-19d3-4c12-abbb-dc158975544e

报的错误如下:
Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)'

有大佬知道是什么原因,怎么处理吗?求解答

@taro-bot
Copy link

taro-bot bot commented Aug 6, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@luckyadam
Copy link
Member

在什么平台下报的错,具体错误截图看下

@archerQ
Copy link
Author

archerQ commented Aug 7, 2019

在什么平台下报的错,具体错误截图看下

在H5中

图片

@zhongyao-x
Copy link

楼主问题解决了吗 是怎么回事?

@meiye1988
Copy link

楼主后面解决了吗 现在我遇到和你一样情况 望楼主指教下谢谢

@Link-X
Copy link

Link-X commented Apr 14, 2021

楼主后面解决了吗现在我遇到和你一样情况
用h5原生canvas api。别用小程序的就行。

@Link-X
Copy link

Link-X commented Apr 28, 2021

楼主后面解决了吗现在我遇到和你一样情况
用h5原生canvas api。别用小程序的就行。

后面h5单独写了一套。没用Taro.createCanvasContext()。

@ZakaryCode ZakaryCode added the T-h5 Target - 编译到 H5 label Jan 15, 2022
@ZakaryCode ZakaryCode added the V-2 Version - 2.x label Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-h5 Target - 编译到 H5 V-2 Version - 2.x
Projects
Archived in project
Development

No branches or pull requests

6 participants