- button组件longpress事件页面刷新,有时会无效
button组件longpress事件在进入页面后,马上进行页面下拉刷新操作,有时longpress事件没有触发,而touchstart事件可以触发。 [代码]<[代码][代码]button[代码] [代码]catchlongpress[代码][代码]=[代码][代码]'start'[代码] [代码]catchtouchmove[代码][代码]=[代码][代码]"move"[代码] [代码]catchtouchend[代码][代码]=[代码][代码]'stop'[代码][代码]>长按[代码]button[代码][代码]>[代码][代码]将 catchlongpress 改成 catchtouchstart 不管怎么刷新页面都能触发。 请官方童鞋看看。
2018-03-29 - Android系统下InnerAudioContext第一次点击播放无声音
使用innerAudioContext play方法播放语音时Android系统第一次点击无声音,第二次点击可正常播放。iOS系统正常。 第一次innerAudioContext回调方法都正确,就是没声音。第二次点击播放可正常播放,有声音,回调函数与第一次回调流程一致。 var voiceSrc = event.currentTarget.dataset.src; 比较怪异的是这一句代码使用固定的连接地址第一次播放就正常。难道dataset 方式参数变了?从日志打印来看语音文件链接是正确的,可正常下载。 如: var voiceSrc = 'https://host/audio.wav'; API使用方式如下: // list.js const innerAudioContext = wx.createInnerAudioContext(); toPlayVoice: function (event) { var voiceSrc = event.currentTarget.dataset.src; // 在这里日志打印 voiceSrc 连接是正确的,浏览器访问可正常下载 innerAudioContext.src = voiceSrc; innerAudioContext.play() }, onLoad: function() { //录音的回调写在onLoad就只调用一次 innerAudioContext.onPlay(() => { console.log('开始播放') }) innerAudioContext.onError((res) => { console.log("error errMsg" + res.errMsg) console.log("error errCode" + res.errCode) }) innerAudioContext.onWaiting(() => { console.log("onWaiting") }) innerAudioContext.onCanplay(() => { console.log("onCanplay") }) innerAudioContext.onEnded(() => { console.log('播放结束'); }) } // list.wxml <template name="receive_get_item_template"> <button type="primary" data-src="{{item.path}}"hover-class='none' bindtap='toPlayVoice'>{{item.duration}}</button> </template>
2018-03-20