提交 21a802ec 编写于 作者: 雪洛's avatar 雪洛

Merge branch 'dev' of https://github.com/dcloudio/uni-app into dev

...@@ -11,7 +11,7 @@ import { ...@@ -11,7 +11,7 @@ import {
disableScrollBounce disableScrollBounce
} from 'uni-shared' } from 'uni-shared'
function onClick (dom, callback) { function initClick (dom) {
const MAX_MOVE = 20 const MAX_MOVE = 20
const hasTouchSupport = navigator.maxTouchPoints const hasTouchSupport = navigator.maxTouchPoints
let x = 0 let x = 0
...@@ -24,7 +24,17 @@ function onClick (dom, callback) { ...@@ -24,7 +24,17 @@ function onClick (dom, callback) {
dom.addEventListener(hasTouchSupport ? 'touchend' : 'mouseup', (event) => { dom.addEventListener(hasTouchSupport ? 'touchend' : 'mouseup', (event) => {
const info = hasTouchSupport ? event.changedTouches[0] : event const info = hasTouchSupport ? event.changedTouches[0] : event
if (Math.abs(info.clientX - x) < MAX_MOVE && Math.abs(info.clientY - y) < MAX_MOVE) { if (Math.abs(info.clientX - x) < MAX_MOVE && Math.abs(info.clientY - y) < MAX_MOVE) {
callback(info) let customEvent = new CustomEvent('click', {
bubbles: true,
cancelable: true,
target: event.target,
currentTarget: event.currentTarget
});
['screenX', 'screenY', 'clientX', 'clientY', 'pageX', 'pageY'].forEach(key => {
customEvent[key] = info[key]
})
console.log(customEvent)
event.target.dispatchEvent(customEvent)
} }
}) })
} }
...@@ -84,7 +94,7 @@ export default { ...@@ -84,7 +94,7 @@ export default {
this.init() this.init()
this.update() this.update()
}) })
onClick(this.$el, this._handleTap.bind(this)) initClick(this.$el)
}, },
methods: { methods: {
_setItemHeight (height) { _setItemHeight (height) {
...@@ -189,7 +199,8 @@ export default { ...@@ -189,7 +199,8 @@ export default {
ref: 'main', ref: 'main',
staticClass: 'uni-picker-view-group', staticClass: 'uni-picker-view-group',
on: { on: {
wheel: this._handleWheel wheel: this._handleWheel,
click: this._handleTap
} }
}, },
[ [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册