I was wondering if there is a way to use two event parameters with v-on (@).
Ex:
<div @click:mouseover="someFunction"></div>
Instead of writing:
<div @click="someFunction" @mouseover="someFunction"></div>
CodePudding user response:
No, it's not possible, each event is handled separately, but there's another syntax which handle the events with object syntax :
<div @="{click:someFunction, mouseover:someFunction}"></div>
CodePudding user response:
No, each event should be specified one way or another.
You could bind them via an object if you want less bloat in your template.
psudo code:
<template>
<div v-on="handlers" />
</template>
<script>
...
data() {
return {
handlers: {
'click': func,
'mouseOver': func,
...
}
}
}
...
</script>