语法上也没什么错误啊,在h5上是能正常播放的,为什么到小程序上就不行呢?
<script>
export default {
data() {
return {
music:'https://fqimg.i-mall.top/upload/bgmusic/10bfa5222413786380c168bc11c65a92.mp3',
handler:null,
}
},
methods: {
play(){
this.handler.play();
},
stop(){
this.handler.stop();
}
},
onLoad() {
this.$nextTick(() => {
this.handler = uni.createInnerAudioContext();
this.handler.src = this.music;
this.handler.play();
})
},
onUnload() {
this.handler.destroy();
},
onHide() {
this.stop();
},
onShow() {
if(this.handler){
this.play();
}
}
}
</script>
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)