Skip to content

关于touchstart做了"阻止默认", 那么mousedown等后续事件就不触发了. #94

@any86

Description

@any86

https://codesandbox.io/s/charming-beaver-qq4ozv?file=/src/components/HelloWorld.vue

移动端会触发mouse事件, 这个是我之前不知道的, 所以我的手势库在"不阻止默认"的情况下, 在手机上touch/mouse都会触发.
如果touchstart内阻止默认了, 那么mouse相关事件都不会触发了.

这里只是记录, 稍后版本要做些兼容

    this.$el.addEventListener('touchstart', e=>{
      e.preventDefault();
    })


    this.$el.addEventListener('mousedown', e=>{
      e.preventDefault();
    })


    this.$el.addEventListener('mouseup', e=>{
      alert(e.type)
    })

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions