[vue] how can watch, in component An also work in component B?

problem description: use VUEX, to put a variable a. Then use watch to listen to an in component B, and perform something when a changes (because you need to use dom, in component B, so use watch), in B and then the page route jumps to component C. when I change an in C, I can"t trigger watch in B. B and C are two pages, routing jump, should be after the jump destroyed the watch in B.

question: how can I change an in C so that B"s watch can be triggered? -sharp-sharp-sharp problem description

Feb.25,2022

has been resolved, in the route jump part, wrap it with keep-alive, so that the component will have a cache so that the component will not be destroyed. Watch can also be used.

Menu