<view @click="playMp()" style="margin: 20rpx;">播放</view>
<view @click="pauseMp()">暂停</view>
js
onLoad() {
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.src = '/static/11.mp3';
innerAudioContext.onPlay(function(){
console.log('开始播放');
});
innerAudioContext.onPause(function(){
console.log('暂停');
})
},
methods: {
playMp(){
this.innerAudioContext.play();
},
pauseMp(){
this.innerAudioContext.pause();
},
}
问题:浏览器测试报错