VUE difference between the v-if with v-show of

v-if

1, is a real page rendering, during the handover event listener and components within the conditions of the block is kept rebuilding and destruction.
2, it is inert, only when the conditions are met, that is when true, to begin rendering.

v-show
regardless of whether a condition is true, directly rendering the page, just simple CSS styles to hide the display only.

Generally, switching overhead v-if relatively large, rendering the initial v-show is relatively large. If frequent switching is recommended to choose v-show relatively reasonable
operating conditions rarely change when it is recommended to use the v-if.

PS:  back v-if can be used with v-else statement to determine the v-show can not.

Guess you like

Origin www.cnblogs.com/agen-su/p/11386916.html