提交 a30a906f 编写于 作者: Q qiang

feat: 鼠标事件支持 pageX、pageY、clientX、clientY

上级 d24315c7
......@@ -90,12 +90,22 @@ export function processEvent (name, $event = {}, detail = {}, target = {}, curre
stopPropagation () {}
})
if (name.startsWith('mouse')) {
const {
top
} = getWindowOffset()
ret.pageX = $event.pageX
ret.pageY = $event.pageY - top
ret.clientX = $event.clientX
ret.clientY = $event.clientY - top
}
if (__PLATFORM__ === 'app-plus') {
const nid = currentTarget.getAttribute('_i')
ret.options = {
nid
}
// 保留原始 currentTarget 方便后续对比
}
// 保留原始 currentTarget 方便后续对比
ret.$origCurrentTarget = currentTarget
}
......@@ -171,4 +181,4 @@ export function initEvents () {
window.addEventListener('touchmove', touchmove, passiveOptions)
window.addEventListener('touchend', clearLongPressTimer, passiveOptions)
window.addEventListener('touchcancel', clearLongPressTimer, passiveOptions)
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册