search

Home  >  Q&A  >  body text

javascript - When using preloadjs to load files in vue, the fileload event is invalid, causing the complete event to be invalid as well

Need to load some pictures and audio resources, the pseudo code is as follows:

data () {
    assets: []  
},
methods :{
    getAssets () {
        var que = new createjs.LoadQueue(true);
        que.setMaxConnections(5);
        que.on('fileload', this.handleFileLoad, this);
        que.on('complete', this.createLoading, this);
    },
    handleFileLoad (event) {
        this.assets[event.item.id] = event; //这里根本进不来
    },
    createLoading (e) {
        // ...
    }
}

I don’t know if it is a problem with this passed in the vuecomponent object. Please solve it.

大家讲道理大家讲道理2772 days ago1124

reply all(1)I'll reply

  • 滿天的星座

    滿天的星座2017-06-12 09:29:52

    Try changing the third parameter this to window

    reply
    0
  • Cancelreply