How do I not refresh the page when vue routes jump?

the function to be implemented is to select a yard model from page1, jump to page2, selection and pass the value to page1.
the problem now is that when you return to page1, it refreshes the page and erases the rest of the data.

what should I do with this?

Sep.29,2021

you can learn about keep-alive


<keep-alive>
    <page1></page1>
<keep-alive>

keep page1 resident, but note that the original lifecycle functions such as created, mounted, and so on will not be triggered on the second entry, and the second entry will trigger activated.


you can dynamically set the keepAlive attribute value of route.meta to true,. If you want to update some data when returned, update


route plus keepalive attribute

in the activated hook.
Menu