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

canvas hook 写法 draw is not a function #8233

Closed
Swordword opened this issue Dec 9, 2020 · 2 comments
Closed

canvas hook 写法 draw is not a function #8233

Swordword opened this issue Dec 9, 2020 · 2 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@Swordword
Copy link
Contributor

相关平台

微信小程序

复现仓库

https://github.com/Swordword/taro-issue
小程序基础库: 2.12.2
使用框架: React

复现步骤

handleDraw 方法 绘制图形成功,最后的 ctx.draw 方法出错,控制台报出 draw is not a function

期望结果

ctx.draw 正常运行

实际结果

draw is not a function

环境信息

👽 Taro v3.0.17


  Taro CLI 3.0.17 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 14.3.0 - /usr/local/bin/node
      Yarn: 1.21.1 - /usr/local/bin/yarn
      npm: 6.13.7 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.17 => 3.0.17 
      @tarojs/mini-runner: 3.0.17 => 3.0.17 
      @tarojs/react: 3.0.17 => 3.0.17 
      @tarojs/runtime: 3.0.17 => 3.0.17 
      @tarojs/taro: 3.0.17 => 3.0.17 
      @tarojs/webpack-runner: 3.0.17 => 3.0.17 
      babel-preset-taro: 3.0.17 => 3.0.17 
      eslint-config-taro: 3.0.17 => 3.0.17 
      react: ^16.10.0 => 16.14.0 
    npmGlobalPackages:
      typescript: 3.9.7
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Dec 9, 2020
@luckyadam
Copy link
Member

https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html
看一下不同 type 的 canvas 的具体用法

@Swordword
Copy link
Contributor Author

是小程序的问题,文档没有更新。 当 canvas 设置 type='2d' 时,canvasToTempFilePath 不需要在 draw 的回调函数运行,参数由canvasId 改为 canvas 实例就行了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

2 participants