1. Why is component caching needed

There is a concept of dynamic component in Vue, which can help developers better realize the switch between components. However, in the process of dynamic component switching, component instances are recreated, and in the face of frequent changes in requirements, we need to preserve the state of components to save performance

2. Solutions:

To solve the performance waste caused by frequent component switching, the built-in component

in Vue needs to be used. When the
is used to wrap dynamic components, inactive component instances are cached, which is mainly used to preserve component status or avoid re-rendering

3. Examples:

For example, if there is a list and a detail, then the user will open the detail frequently =>

Return to list => Open details… In this case the list and details are a high frequency page, then can

To cache the list component usage so that the user returns the column each time

Table can be quickly rendered from the cache, rather than re-rendered