JS.VUE.V.ON.STYLE

Enforce 'v-on' directive style

Rule Details

This rule enforces v-on directive style which you should use shorthand or long form.

{'vue/v-on-style': ['error']}

Copy
<template>
  <!-- GOOD -->
  <div @click="foo"/>

  <!-- BAD -->
  <div v-on:click="foo"/>
</template>

Options

Default is set to shorthand.

Copy
{
  "vue/v-on-style": ["error", "shorthand" | "longform"]
}
  • "shorthand" (default) ... requires using shorthand.
  • "longform" ... requires using long form.

"longform"

{'vue/v-on-style': ['error', 'longform']}

Copy
<template>
  <!-- GOOD -->
  <div v-on:click="foo"/>

  <!-- BAD -->
  <div @click="foo"/>
</template>

Further Reading

  • Style guide - Directive shorthands (https://vuejs.org/style-guide/rules-strongly-recommended.html#directive-shorthands)

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/