问题描述:在ios系统中bindtouchstart事件执行振动事件有振动反馈。然后手指移动后达到一定距离后执行振动事件,无振动反馈,可以参考kimi小程序中的录音发送内容,手指向上和向下移动时没有振动反馈,安卓手机手指移动时有振动反馈
wxml:
<button class="audio" bindtouchstart="handleTouchStart" bindtouchmove="handleTouchMove" bindtouchend="handleTouchend">
{{recorderStatus !== 3?'正在录音...':'按住说话'}}
</button>
js:
Component({
data:{
recorderStatus:3
startY: 0,
moveY: 0,
},
methods: {
handleTouchStart(e) {
wx.vibrateShort({
type: 'heavy',
success:(res)=>{
console.log('success',res)
},
fail:(err)=>{
console.log('err',err)
},
})
this.setData({
recorderStatus:1,
});
this.data.startY = e.touches[0].clientY;
},
handleTouchMove(e) {
this.data.moveY = e.touches[0].clientY;
const distance = this.data.startY - this.data.moveY;
if (distance > 0 && distance >= this.data.cancelDistance) {
wx.vibrateShort({
type: 'heavy',
success:(res)=>{
console.log('success',res)
},
fail:(err)=>{
console.log('err',err)
},
})
}
},
})
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
我也遇到了,是iPhone 14 pro max,系统是ios18.5,发现在touch事件中会不震动,正常点击tap事件没问题