h5项目中,需要自动播放音频,音频地址接口获取
mounted() {
this.fetchDialogInfo();
},
methods: {
// 获取数据
fetchDialogInfo() {
//此处调接口获取音频地址this.src
this.initAudio()
},
// 初始化播放器
initAudio() {
this.player.src = this.src ;
document.addEventListener(
"WeixinJSBridgeReady",
function() {
alert(111)
this.player.play();
},
false
);
},
}
网上找的解决办法都是使用WeixinJSBridgeReady,但是我这里却触发不了
alert都不出来,求问各位大神是什么原因呀?