1、HTML
<audio ref=‘audio‘ > <source type="audio/mpeg"></audio>
2、script
data () { return { src: ‘‘, alarmSrc: [ {src: ‘/static/audio/callalarm.mp3‘}, {src: ‘/static/audio/firealarm.mp3‘}, {src: ‘/static/audio/otheralarm.mp3‘} ] }}
methods:
one () { this.$refs.audio.src = this.alarmSrc[0].src this.$refs.audio.play()}
原文地址:https://www.cnblogs.com/luckyShuang/p/11978360.html
时间: 2024-10-16 16:30:38