i need to track delete and enter keypress event on same input field and invoke different method. anyone knows how to do that?
thanks
i found the answer, thanks
@shredmaster In the future, submitting how you solved your own problem helps everyone.
Lots of users end up looking to solve the same problem you had, and now they get no where.
Just a few days ago I was wondering the same thing. I ended up attaching the event handlers manually, but would be nice to be able to do it with 'v-on' (still don't know if it's possible or not)
It's possible to do what the OP wanted using this:
<input type="text" @keydown.enter="handleEnter" @keydown.delete="handleDelete" />
See also this CodePen example.
If someone else have the issue where you want to use both a modifier and the default event the ordering is important. Have the default event first.
<input type="text" @keydown="error = false" @keydown.enter="addItem()">
It would be nice that we could chain events, something like v-on:event-one:event-two:and-so-on="tiggerAwesomeness"
, just a suggestion, I have no idea it's even good idea or not.
I was able to get a mouseover to do multiple actions by using the following syntax and using brackets and commas:
@mouseover="[xHover=x, yHover=y]"
Most helpful comment
@shredmaster In the future, submitting how you solved your own problem helps everyone.
Lots of users end up looking to solve the same problem you had, and now they get no where.