vue.js: how to handle click and dblclick events on same element

后端 未结 7 2200
粉色の甜心
粉色の甜心 2021-02-01 16:01

I have a vue component with separate events for click/dblclik. Single click (de)selects row, dblclick opens edit form.

7条回答
  •  情歌与酒
    2021-02-01 16:18

    I use this approach for the same problem. I use a promise that is resolved either by the timeout of 200ms being triggered, or by a second click being detected. It works quite well in my recent web apps.

    {{clickType}}

    Working fiddle: https://jsfiddle.net/MapletoneMartin/9m62Lrwf/

提交回复
热议问题