mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
perf: 优化Android长按事件
This commit is contained in:
parent
e99e069e55
commit
66135d8222
@ -395,6 +395,8 @@ export default {
|
||||
window.__handleLink = (path) => {
|
||||
this.goForward({ path: (path || '').indexOf('/') !==0 ? "/" + path : path });
|
||||
}
|
||||
// 取消长按振动
|
||||
$A.eeuiAppSetHapticBackEnabled(false)
|
||||
},
|
||||
|
||||
otherEvents() {
|
||||
|
||||
8
resources/assets/js/directives/longpress.js
vendored
8
resources/assets/js/directives/longpress.js
vendored
@ -1,4 +1,4 @@
|
||||
const isSupportTouch = "ontouchend" in document;
|
||||
const useModeTouch = $A.isIos() && "ontouchend" in document;
|
||||
// 长按或右键指令
|
||||
const longpress = {
|
||||
bind: function (el, binding) {
|
||||
@ -16,13 +16,13 @@ const longpress = {
|
||||
el.__longpressContextmenu__ = (e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
if (!isSupportTouch) {
|
||||
if (!useModeTouch) {
|
||||
callback(e, el)
|
||||
}
|
||||
}
|
||||
el.addEventListener('contextmenu', el.__longpressContextmenu__);
|
||||
// 不支持touch
|
||||
if (!isSupportTouch) {
|
||||
if (!useModeTouch) {
|
||||
return
|
||||
}
|
||||
// 定义变量
|
||||
@ -68,7 +68,7 @@ const longpress = {
|
||||
unbind(el) {
|
||||
el.removeEventListener('contextmenu', el.__longpressContextmenu__)
|
||||
delete el.__longpressContextmenu__
|
||||
if (!isSupportTouch) {
|
||||
if (!useModeTouch) {
|
||||
return
|
||||
}
|
||||
el.removeEventListener('touchstart', el.__longpressStart__)
|
||||
|
||||
10
resources/assets/js/functions/eeui.js
vendored
10
resources/assets/js/functions/eeui.js
vendored
@ -93,6 +93,16 @@
|
||||
if (!$A.isEEUiApp) return;
|
||||
return requireModuleJs("eeui").keyboardStatus();
|
||||
},
|
||||
|
||||
eeuiAppSetHapticBackEnabled(val) {
|
||||
if (!$A.isEEUiApp) return;
|
||||
return requireModuleJs("webview").setHapticBackEnabled(val);
|
||||
},
|
||||
|
||||
eeuiAppSetDisabledUserLongClickSelect(val) {
|
||||
if (!$A.isEEUiApp) return;
|
||||
return requireModuleJs("webview").setDisabledUserLongClickSelect(val);
|
||||
},
|
||||
});
|
||||
|
||||
window.$A = $;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user