Skip to content
On this page

v-on.native Modifier

This modifier was removed in Vue 3. It will still compile for Vue 3, but log a warning - so If you can live with this warning, just use it anyway for the Vue 2 behavior.

But make sure to always document your component's emitted events with emits: as otherwise in Vue 3, all listeners you pass down will be registered as native listeners too!

Eslint

{
  rules: {
    'vue/no-deprecated-v-on-native-modifier': 'error'
  }
}

Workaround: Custom directive

Vue.directive('v-native', (el, {arg, value }) => el.addEventListener(arg, value))
<my-component v-native:click="handleClick">

Released under the MIT license