vue中使用H5的audio
Mark Lv4

H5audio标签有许多事件

20190127152315247

在应用到vue中后的使用如下:

比如在使用onplay时,要去掉on,用@play派发时间,在methods中定义方法执行体

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<template>
<div>
<audio src="../../static/1.mp3" @play="ready" @pause="pause" controls></audio>
</div>
</template>

<script>
export default {
name: 'musci',
data() {
return {
}
},
methods:{
ready(){
console.log("play click");
},
pause(){
console.log("pause click");
}
}
}
</script>

  • Post title:vue中使用H5的audio
  • Post author:Mark
  • Create time:2020-12-19 20:03:49
  • Post link:https://m.iqimeng.com/2020/12/19/Vue/vue中使用H5的audio/
  • Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.