vue click at the same time an incoming event object and custom parameters

Just passing custom parameters

HTML

<div id="app">
  <button @click="tm(123)">ddddd</button>
</div>

JS code

new Vue({
    el:'#app',
  methods:{
      tm:function(e){
        console.log(e);
    }
  }
})

Only an incoming event object

HTML

<div id="app">
  <button @click="tm">ddddd</button>
</div>

JS code

new Vue({
    el:'#app',
  methods:{
      tm:function(e){
        console.log(e);
    }
  }
})

At the same time an incoming event object and custom parameters

HTML

<div id="app">
  <button @click="tm($event,123)">ddddd</button>
</div>

JS code

new Vue({
    el:'#app',
  methods:{
      tm:function(e,value){
        console.log(e);
        console.log(value);
    }
  }
})

Original Address: https://blog.csdn.net/little_kid_pea/article/details/89736282

Guess you like

Origin blog.csdn.net/qq_24147051/article/details/93628595