• Data cannot be updated on the Vue route switching page

Scenario: Page A goes to page B, and page B returns to page A to bring back data. Page A uses

in corresponding components. Adding

can preserve the status in memory during component switchover to prevent repeated DOM rendering

Solution: The hook function activated is called when the <keep-alive> component is activated. The corresponding hook function deactivated is called when the <keep-alive> component is disabled.