- touchend事件不触发
<view class="tape" catch:longpress='touchdown' catch:touchend="touchup"> <image wx:if="{{!show}}" class="img" mode="aspectFit" src="{{imgPrefix+'/mp/img/tape.png'}}"></image> <view wx:else class="animation"> <view class="ani"></view> <view class="ani"></view> <view class="ani"></view> <view class="ani"></view> </view> </view> data: { imgPrefix: app.globalData.imgPrefix, show:false }, touchdown(e) { console.log('长按'); this.setData({ show: true }) }, touchup(e) { console.log('松开'); this.data.show = false this.setData({ show: false }) }, 只要同事在事件内写 this.setData({}) 就会导致松开事件不触发 要再次点击才会触发 touchdown和touchup方法里使用了this.setData。由于小程序的逻辑层和视图层是双线程,用了setData似乎对脚本产生了阻塞。 z这种情况怎么解决呢
2024-03-29 - wx.compressVideo 不稳定?有时候几分钟过去了,没有任何回调。
const compressVideo = (path: string, id, questionNumber, trys?:any) => { // @ts-ignore Taro.compressVideo({ src: path, bitrate: 400, // 码率(单位 kbps) fps: 24, // 帧率 resolution: 0.5, // 分辨率比例 success: (YRes) => { console.log(`${id}-${questionNumber}-->视频压缩成功`, YRes) onVideoAnsSubmit(YRes.tempFilePath) if(trys){ clearTimeout(trys) } }, fail: (YErr) => { console.log(`${id}-${questionNumber}-->视频压缩失败`, YErr) onVideoAnsSubmit(path) if(trys){ clearTimeout(trys) } } }) } const onAnsEndHandle = () => { if (isRecording.current) { timeout(()=>{ isRecording.current = false }, 1000) cameraCtx.current.stopRecord({ success: (res) => { console.log(`${id}-${questionNumber}-->停止录制视频成功`) const trys = setTimeout(() => { console.log('进入重试') compressVideo(res.tempVideoPath, id, questionNumber, trys) }, 10000) compressVideo(res.tempVideoPath, id, questionNumber, trys) }, fail: (err) => { console.log(`${id}-${questionNumber}-->停止录制视频失败`, err) if(err.errMsg!='operateCamera:fail:is stopping'){ console.error(`${id}-${questionNumber}-->停止录像失败`, err) isRecording.current = false backFunc() } } }) } }
04-30 - 小程序接入trtc后,关闭小程序,会一直显示这个悬浮窗,甚至关闭微信都还在,一直在后台运行,导致手机
[图片]
04-28