79277412

Date: 2024-12-13 06:51:01
Score: 0.5
Natty:
Report link

If you are using Vue 3, you can try v-lazy-show of Antfu - Member of Vuejs core team.

It can be helpful to use with some component that is expensive to create/mount. For example, if you have a tabs component, that some tab contains a heavy component. Using v-if, it will get the component destroyed and re-created when switching tabs. Using v-show, you will need to pay the mounting cost on the initial render even you haven't switch to that tab yet. With v-lazy-show, you can have the best of both worlds. You can think it as a v-show that lazy initializes, or a v-if that caches the DOM.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: TrippleN