Back to Developer Roadmap

v-if

src/data/roadmaps/vue/content/[email protected]

4.0516 B
Original Source

v-if

Conditionally render an element or a template fragment based on the truthy-ness of the expression value. When a v-if element is toggled, the element and its contained directives / components are destroyed and re-constructed. If the initial condition is falsy, then the inner content won't be rendered at all.

Example

html
<h1 v-if="awesome">Vue is awesome!</h1>

Visit the following resources to learn more: