During toggles, v-if entirely creates and destroys the element, including event listeners and child components:
<template>
<MyComponent v-if="showComponent" />
</template>
v-show creates the element and only toggles its visibility using CSS.
<template>
<MyComponent v-show="showComponent" />
</template>
If you liked this Vue tip, follow me on Twitter to get notified about new tips, blog posts, and more. Alternatively (or additionally), you can subscribe to my weekly Vue & Nuxt newsletter :
