let timeOutEvent: any;
const touchstart = (event: any) => {
// 长按事件触发
timeOutEvent = setTimeout(function () {
// 开始录音
if (!isVocieing.value) {
isVocieing.value = true;
recStart();
}
}, 500);
};
const touchend = (event: any) => {
clearTimeout(timeOutEvent);
// 结束录音
if (isVocieing.value) {
handleSend();
}
};
【JavaScript】移动端长按事件触发录音
于 2024-04-26 09:26:15 首次发布