else if in vue code example

Example 1: v-if vs v-show

v-if vs v-show
v-if is “real” conditional rendering because it ensures that 
event listeners and child components inside the conditional 
block are properly destroyed and re-created during toggles.

v-if is also lazy: if the condition is false on initial render, 
it will not do anything - the conditional block won’t be rendered 
until the condition becomes true for the first time.

In comparison, v-show is much simpler - the element is always
rendered regardless of initial condition, with CSS-based toggling.

Generally speaking, v-if has higher toggle costs while v-show has 
higher initial render costs. So prefer v-show if you need to toggle 
something very often, and prefer v-if if the condition is unlikely 
to change at runtime.

Example 2: v-if vuejs

Vue is awesome !

Vue is not very nice !

Vue is baaaad !

Example 3: vue v-if

Now you see me
Now you don't

Tags:

Misc Example