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

在WePY框架下使用wxDraw报错 #41

Closed
Blueria opened this issue Feb 11, 2018 · 2 comments
Closed

在WePY框架下使用wxDraw报错 #41

Blueria opened this issue Feb 11, 2018 · 2 comments

Comments

@Blueria
Copy link

Blueria commented Feb 11, 2018

WePY框架下使用wxDraw时,报错,Hello world都做不到

使用大致如下:

<canvas
    class="effect_canvas"
    canvas-id="effectCanvas"
    disable-scroll
></canvas>
import wepy from 'wepy'
import { wxDraw as WxDraw, Shape } from '../plugins/wxdraw'

export default class Index extends wepy.page {
    data = {
        wxCanvas: null
    }

    onLoad() {
        const context = wx.createCanvasContext('effectCanvas')
        this.wxCanvas = new WxDraw(context, 0, 0, 400, 500)
    }
}

报错如下:

wxdraw

@Blueria
Copy link
Author

Blueria commented Feb 20, 2018

自己解决了:
不能将wxCanvas放在data里,直接作为类属性即可(如下),data下的变量会被脏检查(此时会遇到问题)

import wepy from 'wepy'
import { wxDraw as WxDraw, Shape } from '../plugins/wxdraw'

export default class Index extends wepy.page {
    wxCanvas =  null

    onLoad() {
        const context = wx.createCanvasContext('effectCanvas')
        this.wxCanvas = new WxDraw(context, 0, 0, 400, 500)
    }
}

@BoleLee
Copy link

BoleLee commented Jul 3, 2018

在wepy中,试用了画一个rect并加动画,正常;
改为画一个图片,无显示,没有报错,不知道原因;
在同一个canvas画两个rect, 其中一个设了动画,只显示了设动画的那个,且动画不进行,另一个则不显示,原因未明;

第一次使用wxDraw,求助 @bobiscool @Blueria

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants