Skip to content

event modifier ​

Event modifiers are used to express common DOM event options and interception behaviors.

html
<button @click.stop="select">选择</button>
<form @submit.prevent="submit"></form>
<button @click.once="init">初始化一次</button>

Supported modifiers ​

ModifierMeaning
.stopCall event.stopPropagation()
.preventCall event.preventDefault()
.selfOnly handle events whose target is itself
.onceaddEventListener of once
.captureCapture phase monitoring
.passivepassive monitoring

Select suggestions ​

Simple scenarios use modifiers, and complex logic is written in the handler. This makes TypeScript types clearer and easier to test.