提交 dc15614f 编写于 作者: X xzs02

fix: 补充h5端点击事件缺少的信息

build uni-h5 0.0.12
上级 b1a90d6a
{ {
"name": "@dcloudio/uni-h5", "name": "@dcloudio/uni-h5",
"version": "0.0.12", "version": "0.0.13",
"description": "uni-app h5", "description": "uni-app h5",
"main": "dist/index.umd.min.js", "main": "dist/index.umd.min.js",
"scripts": { "scripts": {
......
...@@ -55,6 +55,26 @@ export function processEvent (name, $event = {}, detail = {}, target = {}, curre ...@@ -55,6 +55,26 @@ export function processEvent (name, $event = {}, detail = {}, target = {}, curre
return $event return $event
} }
// fixed 针对小程序 click(tap)事件,补充事件详情
if (name === 'click') {
const {
top
} = getWindowOffset()
detail = {
x: $event.x - top,
y: $event.y - top
}
$event.touches = $event.changedTouches = [{
force: 1,
identifier: 0,
clientX: $event.clientX,
clientY: $event.clientY,
pageX: $event.pageX,
pageY: $event.pageY
}]
}
// fixed mp-vue // fixed mp-vue
return wrapperMPEvent({ return wrapperMPEvent({
type: detail.type || name, type: detail.type || name,
...@@ -64,8 +84,8 @@ export function processEvent (name, $event = {}, detail = {}, target = {}, curre ...@@ -64,8 +84,8 @@ export function processEvent (name, $event = {}, detail = {}, target = {}, curre
currentTarget: processTarget(currentTarget), currentTarget: processTarget(currentTarget),
touches: processTouches($event.touches), touches: processTouches($event.touches),
changedTouches: processTouches($event.changedTouches), changedTouches: processTouches($event.changedTouches),
preventDefault () {}, preventDefault () { },
stopPropagation () {} stopPropagation () { }
}) })
} }
...@@ -141,4 +161,4 @@ export function initEvents () { ...@@ -141,4 +161,4 @@ export function initEvents () {
window.addEventListener('touchmove', touchmove, passiveOptions) window.addEventListener('touchmove', touchmove, passiveOptions)
window.addEventListener('touchend', clearLongPressTimer, passiveOptions) window.addEventListener('touchend', clearLongPressTimer, passiveOptions)
window.addEventListener('touchcancel', clearLongPressTimer, passiveOptions) window.addEventListener('touchcancel', clearLongPressTimer, passiveOptions)
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册