Passing Arguments to Event Handlers
이벤트 처리에 인수를 전달하는 방법
<button onClick=(e) => this.deleteRow(id, e)>Delete Row</button>
위 처럼 익명 함수를 이용해 이벤트를 처리 가능하다.
vuejs에는 $event가 있다.
<button v-on:click="warn('Form cannot be submitted yet.', $event)">
Submit
</button>
// ...
methods: {
warn: function (message, event) {
// now we have access to the native event
if (event) event.preventDefault()
alert(message)
}
}