When we switch from one component to another, the routing component that has not been displayed remains mounted and not destroyed. When we switch back, the previous data is still maintained, for example, entering data in a text box, Then switch to another page, and then switch to the previous text box interface, the data of the text box is still saved. The web page experience will be better.
The usage method is as follows: use the <keep-alive> tag, which can also use include attribute: string or regular expression, only matching components will be cached, exclude attribute: string or regular expression, any successful matching component will be Will not be cached, used more.
<keep-alive :include="['AAA','BBB']"> <router-view></router-view> </keep-alive>
<keep-alive :include="['AAA','BBB']">
<router-view></router-view>
</keep-alive>
Comments
Post a Comment