2017-02-28 84 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
相關問題