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

小程序中bitmap加载后没有回调 #9

Closed
hujian opened this issue Jun 26, 2018 · 3 comments
Closed

小程序中bitmap加载后没有回调 #9

hujian opened this issue Jun 26, 2018 · 3 comments

Comments

@hujian
Copy link

hujian commented Jun 26, 2018

小程序的onload方法没有回调

class Bitmap extends DisplayObject {
  constructor (img, onLoad) {
    super()
    if (typeof img === 'string') {
      if (Bitmap.cache[img]) {
        this.img = Bitmap.cache[img]
        this.rect = [0, 0, this.img.width, this.img.height]
        onLoad && onLoad.call(this)
        this.width = this.img.width
        this.height = this.img.height
      } else if (util.isWeapp) {
        util.getImageInWx(img, (result) => {
          this.img = result.img
          if (!this.rect) {
            this.rect = [0, 0, result.width, result.height]
          }
        })
      } else {
@dntzhang
Copy link
Owner

配了 download 合法 url吗? 真机还是模拟器?

@hujian
Copy link
Author

hujian commented Jun 26, 2018

小程序分支下面,你没有回调onload啊,加上onLoad && onLoad.call(this)就好了

      } else if (util.isWeapp) {
        util.getImageInWx(img, (result) => {
          this.img = result.img
          if (!this.rect) {
            this.rect = [0, 0, result.width, result.height]
          }
        })

@dntzhang
Copy link
Owner

ok 看到了~~ 多谢~

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