mounted() {
// 播放音乐
document.addEventListener(“touchstart”, this.audioAutoPlay, false);
let oAudio = document.querySelector("#audio");
oAudio.onended = function() {
//播放完毕,重新循环播放
oAudio.load();
oAudio.play();
};
}
audioAutoPlay() {
let audio = document.getElementById(“audio”);
audio.play();
document.removeEventListener(“touchstart”, this.audioAutoPlay);
}
来源:CSDN
作者:qq_39216281
链接:https://blog.csdn.net/qq_39216281/article/details/103687841