uni-app扫码添加声音
uni-app uni.scanCode 扫码是再开发app时扫码是没有声音的只有震动,那扫码如何添加声音呢?uni.scanCode({success: (res) => {consle.log(res)const innerAudioContext = uni.createInnerAudioContext();innerAudioContext.autoplay = true;inne
·
uni-app uni.scanCode app扫码时是没有声音的只有震动,那扫码如何添加声音呢?
uni.scanCode({
success: (res) => {
consle.log(res)
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src = '/static/video/9360.wav'; //音频地址
innerAudioContext.onPlay(() => {
console.log('开始播放');
});
}
});
这样扫码时就会有声音了
更多推荐
已为社区贡献2条内容
所有评论(0)