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

后端 未结 7 2195
粉色の甜心
粉色の甜心 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:30
    <div id="example-1">
     <button v-on:dblclick="counter += 1, funcao()">Add 1</button>
       <p>The button above has been clicked {{ counter }} times.</p>
    </div>
    
    var example1 = new Vue({
     el: '#example-1',
     data: {
       counter: 0
     },
     methods: {
       funcao: function(){
         alert("Sou uma funcao");
       }
     }
    })
    

    check out this working fiddle https://codepen.io/robertourias/pen/LxVNZX

    0 讨论(0)
提交回复
热议问题