JS.VUE.V.BIND.STYLE

Enforce 'v-bind' directive style

Rule Details

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

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

Copy
<template>
  <!-- GOOD -->
  <div :foo="bar"/>

  <!-- BAD -->
  <div v-bind:foo="bar"/>
</template>

Options

Default is set to shorthand.

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

"longform"

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

Copy
<template>
  <!-- GOOD -->
  <div v-bind:foo="bar"/>

  <!-- BAD -->
  <div :foo="bar"/>
</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/