<input v-on:click.ctrl="SelectedMultiple(item.id)" v-on:click="Selected(item.id)" />
如上 我想实现的是 按住ctrl的时候多选
但是在触发SelectedMultiple之后会再次触发Selected事件
这个该如何解决呢?
高洛峰2017-05-19 10:46:42
Each v-on will have an independent handler. When the event is triggered, it is placed in an array and executed sequentially.
They will not affect each other. @click.ctrl cannot prevent the execution of @click.
So it can only be executed in @click judges $event to filter out events where ctrl is pressed
<input @click.ctrl="SelectedMultiple(item.id)"
@click="!$event.ctrlKey && Selected(item.id)" />