Keep-alive is a built-in component of the VUE that allows the contained component to be left in a preserved state or to avoid being rerendered.
<div>
<keep-alive>
<router-view></router-view><!-- The components in this are cached in the-->
</keep-alive>
</div>
Next, let’s combine the Settings of router caching section page
in app.vue
<template>
<div id="app">
<!-- This is with the components. -->
<!-- add cache -->
<keep-alive>
<router-view v-if="this.$route.meta.keep"></router-view>
</keep-alive>
<router-view v-if="!this.$route.meta.keep"></router-view>
</div>
</template>
Add the configuration meta
router to configure keep, which requires true cache instead of false
{
path: '/shop_detail',
name: 'shop_detail',
component: shop_detail,
meta:{
keep:true // keep(optional name) true means the page needs to be cached.
}
},
{
path: '/details',
name: 'details',
component: details,
meta:{
keep:false // keep(optional name) false means the page does not need to be cached.
}
},
Read More:
- [How to Fix]Element is not attached to the page document record
- [Solved] Nginx cannot access pictures on FTP Error: Whitelabel error page
- [Solved] Syntax Error: TypeError: Cannot read property ‘parseComponent‘ of undefined (vue报错)
- [Solved] Error report of introducing Vue into ecarts GL
- Vue uses localstorage and sessionstorage to store data
- Linux Traceroute Command Examples
- Installation, Configuration and Simple Use of Rancher
- The use of Android setgravity()
- ./configure Command Execute error (Centos7 Install erlang)
- [Nginx] solution: it can’t be accessed on the background API interface after HTTPS (access the specified port through the domain name)
- Solved: could not find the task ‘G + + build active file, leetcode algorithm ACM compilation and debugging
- petalinux-build Error: ERROR: Task (/opt/pkg/petalinux/components/yocto/source/aarch64/layers/meta-xilinx-tools/recipes-bsp/fsbl/fsbl_git.bb:do_compile) failed with exit code ‘1’
- Petalinux Failed to open PetaLinux lib: librdi_commonxillic.so: cannot open shared object file:
- Nginx error: nginx: [error] invalid PID number ““ in “/run/nginx.pid“
- Nginx realizes the same background service for portal and business
- [Solved] Centos7 Error: gcc: configure: error: in build‘: configure: error: no acceptable C compiler found in $PATH
- Nginx Error: nginx: [emerg] the “ssl“ parameter requires ngx_http_ssl_module in /project/api/nginx.conf:
- Detailed explanation of basic lstmcell in tensorflow learning
- Solve the problem of 404 Not Found error in nginx accessing dynamic interface
- Could not find an NgModule. Use the skip-import option to skip importing in NgModule