Sometimes, we want to hide a div with Vue.js.
In this article, we’ll look at how to hide a div with Vue.js.
How to hide a div with Vue.js?
To hide a div with Vue.js, we can use the v-if
directive.
For instance, we write
<template>
<div>
<div v-if="seen" id="hide">
<p>hide me</p>
</div>
</div>
</template>
to show the div only if seen
if true
by adding v-if="seen"
to the div.
Conclusion
To hide a div with Vue.js, we can use the v-if
directive.