In short, the v-if is initialized faster, but the switching cost is high; The v-show initialization is slow, but the switching costs are 1 lower. Common denominator
are dynamically displaying DOM elements 2. Differences
(1) means:
V-if is the dynamic addition or deletion of DOM elements to the DOM tree;
V-show is controlled by setting the display style property of the DOM element;
(2) Compile process:
The V-IF switch has a local compile/unload process that properly destroys and rebuilds the internal event listener and sub-components during the switchover process;
V-show is just a simple CSS-based switch;
(3) Compile condition:
The v-if is inert and does nothing if the initial conditions are false, and only when the condition first becomes true does it start the local compilation (the compilation is cached. After the compilation is cached, and then switch the time for partial uninstallation);
V-show is compiled under any conditions (whether the first condition is true), then cached, and the DOM element is preserved;
(4) Performance consumption:
The v-if has higher switching consumption;
V-show has higher initial rendering consumption;
(5) Use the scene:
V-if suitable operating conditions are unlikely to change;
The v-show is suitable for frequent switching.
For more information, please see the original http://www.cnblogs.com/wmhuang/p/5420344.html