Passing event and argument to v-on in Vue.js
<p>I pass a parameter in <code>v-on:input</code> directives. If I don't pass it, I can access the event in the method. Is there any way I can still access the event when passing the parameter to the function? Note that I am using vue-router.</p>
<p>This is without passing the parameter. I can access the event object:</p>
<p>HTML</p>
<pre class="lang-html prettyprint-override"><code>&lt;input type=&quot;number&quot; v-on:input=&quot;addToCart&quot; min=&quot;0&quot; placeholder=&quot;0&quot;&gt;
</code></pre>
<p>Javascript</p>
<pre class="lang-js prettyprint-override"><code>methods: {
  addToCart: function (event) {
    // I need to access the element by using event.target
    console.log('In addToCart')
    console.log(event.target)
  }
}
</code></pre>
<p>This is when passing the parameter. I can't access the event object:</p>
<p>HTML</p>
<pre class="lang-html prettyprint-override"><code>&lt;input type=&quot;number&quot; v-on:input=&quot;addToCart(ticket.id)&quot; min=&quot;0&quot; placeholder=&quot;0&quot;&gt;
</code></pre>
<p>Javascript</p>
<pre class="lang-js prettyprint-override"><code>methods: {
  addToCart: function (id) {
    // How can I access the element by using event
    console.log('In addToCart')
    console.log(id)
  }
}
</code></pre>
<p>Here is a fiddle of the code, it should be good enough to replicate the problem that I am having:</p>
<p><a href="https://jsfiddle.net/lookman/vdhwkrmq/" rel="noreferrer">https://jsfiddle.net/lookman/vdhwkrmq/</a></p>