mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-15 13:22:49 +00:00
perf: 优化Android长按事件
This commit is contained in:
parent
e99e069e55
commit
66135d8222
@ -395,6 +395,8 @@ export default {
|
|||||||
window.__handleLink = (path) => {
|
window.__handleLink = (path) => {
|
||||||
this.goForward({ path: (path || '').indexOf('/') !==0 ? "/" + path : path });
|
this.goForward({ path: (path || '').indexOf('/') !==0 ? "/" + path : path });
|
||||||
}
|
}
|
||||||
|
// 取消长按振动
|
||||||
|
$A.eeuiAppSetHapticBackEnabled(false)
|
||||||
},
|
},
|
||||||
|
|
||||||
otherEvents() {
|
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 = {
|
const longpress = {
|
||||||
bind: function (el, binding) {
|
bind: function (el, binding) {
|
||||||
@ -16,13 +16,13 @@ const longpress = {
|
|||||||
el.__longpressContextmenu__ = (e) => {
|
el.__longpressContextmenu__ = (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
if (!isSupportTouch) {
|
if (!useModeTouch) {
|
||||||
callback(e, el)
|
callback(e, el)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
el.addEventListener('contextmenu', el.__longpressContextmenu__);
|
el.addEventListener('contextmenu', el.__longpressContextmenu__);
|
||||||
// 不支持touch
|
// 不支持touch
|
||||||
if (!isSupportTouch) {
|
if (!useModeTouch) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 定义变量
|
// 定义变量
|
||||||
@ -68,7 +68,7 @@ const longpress = {
|
|||||||
unbind(el) {
|
unbind(el) {
|
||||||
el.removeEventListener('contextmenu', el.__longpressContextmenu__)
|
el.removeEventListener('contextmenu', el.__longpressContextmenu__)
|
||||||
delete el.__longpressContextmenu__
|
delete el.__longpressContextmenu__
|
||||||
if (!isSupportTouch) {
|
if (!useModeTouch) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
el.removeEventListener('touchstart', el.__longpressStart__)
|
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;
|
if (!$A.isEEUiApp) return;
|
||||||
return requireModuleJs("eeui").keyboardStatus();
|
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 = $;
|
window.$A = $;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user