搜到了一篇https://blog.csdn.net/weixin_40024174/article/details/79015665 这个文章的代码 稍作改动 便可以解决我的需求了 我的需求是用一个按钮控制本地音乐的开关 [图片] [代码]//播放背景音乐[代码][代码] [代码][代码]//this.***为全局变量,可以在其他方法中调用[代码][代码]data:{[代码][代码]bindAnimation2Status:0[代码][代码]//控制播放状态[代码][代码]}[代码][代码] [代码][代码]createAudio: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]this[代码][代码].innerAudioContext = wx.createInnerAudioContext()[代码][代码] [代码][代码]this[代码][代码].innerAudioContext.autoplay = [代码][代码]true[代码][代码] [代码][代码]this[代码][代码].innerAudioContext.src = [代码][代码]'/music/love.mp3'[代码][代码] [代码][代码]},[代码] [代码] [代码][代码]playMusic: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]if[代码] [代码]([代码][代码]this[代码][代码].data.bindAnimation2Status == 0) {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]bindAnimation2Status: 1[代码][代码] [代码][代码]})[代码][代码] [代码][代码]this[代码][代码].innerAudioContext.play();[代码][代码] [代码][代码]}[代码][代码]else[代码][代码]{[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]bindAnimation2Status: 0[代码][代码] [代码][代码]})[代码][代码] [代码][代码]this[代码][代码].innerAudioContext.pause();[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码]
wx.createInnerAudioContext()怎么用按钮开始播放???首先 在 onload里面写入了 const innerAudioContext = wx.createInnerAudioContext() innerAudioContext.autoplay = false innerAudioContext.loop = true innerAudioContext.src = '/music/love.mp3' 然后给按钮加一个绑定事件 我该怎么执行innerAudioContext .play() 呢?
2018-06-05https://www.baidu.com/link?url=IiQjFHwOPqIE3zyye-G83oAevsboacQcP74PKs5UkVMWR9n1bCTmJ3szBTyuSQH4f9TT_N5F1G-Wcw-7Cx5Foa&wd=&eqid=a6e427f30000fe5c000000045b15f26f
请问小程序中&#开头的字符编码如何解析成字符有些文字从后台获取过来是类似 中国 的,在小程序中如何解析成字符
2018-06-05