v-if
vs v-show
v-if
It is the "real" conditions rendering, because it will ensure that the event listener and sub-components within the conditional block is destroyed and rebuilt properly in the handover process.
v-if
It is inert: If the condition is false at the time of the initial rendering, do nothing - until the condition becomes true when the first time, will begin to render conditional block.
In contrast, v-show
it is much simpler - no matter what the initial conditions, the elements will always be rendered, and simply based on the CSS switch.
Generally, v-if
a higher switching overhead, and v-show
has a higher initial cost of rendering. Therefore, if the very frequently need to switch, is used v-show
preferably; if conditions rarely changes during operation, is used v-if
preferably.