perf: 优化Android点击发送按钮效果

This commit is contained in:
kuaifan 2024-05-11 12:34:27 +09:00
parent 2bda6bf668
commit 6880baa6a4
2 changed files with 14 additions and 0 deletions

View File

@ -18,6 +18,9 @@ export default {
isTouch = false; isTouch = false;
binding.value("up"); binding.value("up");
} }
},
click: e => {
binding.value("click", e);
} }
}; };
if (isSupportTouch) { if (isSupportTouch) {
@ -29,6 +32,7 @@ export default {
document.addEventListener('mousemove', el.__touchEvent__.move); document.addEventListener('mousemove', el.__touchEvent__.move);
document.addEventListener('mouseup', el.__touchEvent__.end); document.addEventListener('mouseup', el.__touchEvent__.end);
} }
el.addEventListener('click', el.__touchEvent__.click);
}, },
update () { update () {
@ -43,6 +47,7 @@ export default {
document.removeEventListener('mousemove', el.__touchEvent__.move); document.removeEventListener('mousemove', el.__touchEvent__.move);
document.removeEventListener('mouseup', el.__touchEvent__.end); document.removeEventListener('mouseup', el.__touchEvent__.end);
} }
el.removeEventListener('click', el.__touchEvent__.click);
delete el.__touchEvent__; delete el.__touchEvent__;
} }
}; };

View File

@ -320,6 +320,7 @@ export default {
recordDuration: 0, recordDuration: 0,
touchStart: {}, touchStart: {},
touchFocus: false,
touchLimitX: false, touchLimitX: false,
touchLimitY: false, touchLimitY: false,
@ -1019,6 +1020,7 @@ export default {
} }
switch (action) { switch (action) {
case 'down': case 'down':
this.touchFocus = this.quill?.hasFocus();
this.touchLimitX = false; this.touchLimitX = false;
this.touchLimitY = false; this.touchLimitY = false;
this.touchStart = event.type === "touchstart" ? event.touches[0] : event; this.touchStart = event.type === "touchstart" ? event.touches[0] : event;
@ -1048,6 +1050,13 @@ export default {
} }
this.onSend() this.onSend()
break; break;
case 'click':
if (this.touchFocus) {
this.quill.blur();
this.quill.focus();
}
break;
} }
}, },