Keep-alive tabs
This is the heavier alternative mentioned earlier: instead of moving state into a service,
both KeepAliveTabContent components below are created once, when this page first
loads, and stay mounted the whole time — switching tabs only toggles a CSS
display style. Their own private fields survive because the components
themselves are never disposed.
Note: this is a self-contained example on a single page. Wiring this same idea up to real navbar routes (so it works across your whole app, not just within one page) means replacing the default Router/RouteView with your own container that keeps several routed pages mounted at once — more plumbing than the scoped-service approach, but no need to manually shuttle values in and out of a service.
Tab A content. Type below, switch tabs, then come back — still here, because this component instance was never destroyed, only hidden with CSS.
You typed: