Using custom HTML declarations, Vue allows you to render elements and contents conditionally based on data attributes or JavaScript declarations. These include v-if, for showing a container whether a declaration equates to true, and v-else, to show an alternative.
Conditional rendering
v-if
The most basic example of this would be the v-if directive – determining a value or function if the block should be displayed.
Create a Vue instance with a single div inside the view and a data key, isVisible, set to false.
View:
Start off with the view code as the following:
<div id="app">
<div>Now you see me</div>
</div>
JavaScript:
In the JavaScript, initialize Vue and create...