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

小程序中自定义Element 使用报错 #10

Closed
JasonMiss opened this issue Jun 26, 2018 · 1 comment
Closed

小程序中自定义Element 使用报错 #10

JasonMiss opened this issue Jun 26, 2018 · 1 comment

Comments

@JasonMiss
Copy link

import cax from './index'

export default class poker extends cax.Group {
constructor() {
super()
const bitmap = new cax.Bitmap('../../image/user_avatar_test.png')
bitmap.scaleX = bitmap.scaleY = 0.5
this.add(this.bitmap)
}
}

error:
Cannot set property 'parent' of undefined;at "pages/live/live" page lifeCycleMethod onLoad function
TypeError: Cannot set property 'parent' of undefined
at poker.add (http://127.0.0.1:35894/appservice/components/cax/index.js:298:35)
at new poker (http://127.0.0.1:35894/appservice/components/cax/poker.js:29:11)
at r.onLoad (http://127.0.0.1:35894/appservice/pages/live/live.js:67:17)
at r. (

@dntzhang
Copy link
Owner

dntzhang commented Jun 26, 2018

@JasonMiss
你的代码写错了,居然把 undefined的东西add到group里。修改:

this.add(this.bitmap)

改成

 this.add(bitmap)

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

No branches or pull requests

2 participants