Vue TutorialLesson 3Free preview
Vue Directives
This lesson is part of Vue · All levels
Summary
A directive is a special attribute with a v- prefix that instructs the Vue to react to data. The directive is divided into those that react to values such as v-if and v-for, and those that react to events such as v-on. Some directives also accept arguments with a dot mark, e.g. v-bind:href, and modifiers with a dot mark, e.g. v-on:submit.prevent.
Key points
- The directive is written as an HTML attribute with the prefix v-.
- The value directive controls the appearance or structure, for example v-if and v-for.
- The event directive responds to user interactions, for example v-on.
- Arguments use point marks, for example v-bind:href and v-on:click.
- The modifier uses a dot mark, for example .prevent on the submit.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.