0
这就是我如何运作的,但我不喜欢它的外观。我真想让我写它像这样使用Underscore时无法在侦听器上获得videojs _.bind
displayVideo: function displayVideo() {
this.videoJs = videojs('player', {}, _.bind(function() {
this.on('play', this.onPlayerPlayButton);
this.on('pause', this.onPlayerPauseButton);
}, this));
},
我不能给你一个使用您共享的代码进行工作示例,因为很难看出您的方法displayVideo的调用者是谁,所以我无法确定范围是否适合您的案例。 –
没关系,我让它像这样工作让vid = this; vid.on('play',_.bind(self。onPlayerPlayButton,self));在承诺的内部,我已经让自己=这个外面 – devwannabe