Vue’s Keep-Alive Usage Tips

is Vue’s built-in component, which can be kept in memory during component switching process to prevent repeated rendering of DOM

When the dynamic component is wrapped, the unacceptable component instance can be cached. Not to destroy them. Similar to is an abstract component: it does not render a DOM element, nor does it appear in the parent component chain.

Method 1

Include: string or regular expression. Only match components will be cached.

Exclude: String or regular expression. No matching components are not cached.


       Method 2 (Combined with BERFOREROUTEENTER, cache section)  

vue的keep-alive用法技巧 The cache page created will only be executed, and Activated will execute each time. In the create, ISFIRSTENTENTENTER = TRUE (because the page is cached, so it has been effective), and then it is not returned in ActiVated. “The first time I came in” refreshed with the data, and it was set to false below to avoid cache the identity. When entering the “list page”, it is judged by the Router hook function BeforeROUTEENTER. Details page Set isback for True, that is, not refreshing the page

The above is all related knowledge points, thank you for your support of TUMI clouds. vue的keep-alive用法技巧

© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment