2017-02-28 79 views
0

全码:https://github.com/kenpeter/test_vue_simple_audio_1@onmouseup不费一枪在vuejs 2

附上@onmouseupinput range。当我拖动滑块,progressChange似乎没有被调用。

<input 
    type="range" 
    :min="0" 
    :step="1" 
    v-model="current" 

    :value="current" 
    :max="duration" 
    @onmouseup="progressChange()" 
    /> 

这里是methods

methods: { 
    timeChange: function() { 
     this.current = this.$refs.player.currentTime; 
    }, 
    getDuration: function() { 
     this.duration = this.$refs.player.duration; 
    }, 
    toggleStatus: function() { 
     var player = this.$refs.player; 
     this.isPause ? player.play() : player.pause(); 
     this.isPause = !this.isPause; 
    }, 
    next: function() { 
     if (this.audioIndex == this.songs.length - 1) { 
     if (this.repeat) { 
      this.audioIndex = 0; 
     } 
     } else { 
     this.audioIndex++; 
     } 
    }, 
    prev: function() { 
     if (this.audioIndex == 0) { 
     if (this.repeat) { 
      this.audioIndex = this.songs.length - 1; 
     } 
     } else { 
     this.audioIndex--; 
     } 
    }, 
    progressChange() { 
     console.log("progress change"); 
    }, 
+1

这是'@ mouseup' –

+0

这是正确的。我错过了。 – kenpeter

+0

未来 - 请在这种情况下 - 回答你自己的问题。我发布了一个答案来完全澄清这个问题,因为有些人可能会在那里寻找。 –

回答

0

要回答谁不想要寻找类似问题的人将来参考这个问题:

的问题是关于调用事件作为VueJS错名字使用@even的语法,其中@代替'on',因此您必须使用:

  • @mouseup
  • @单击
  • @keyup:键名
  • @input
  • @customEventEmitedByComponent