router中
const EReceiptVerifyDetail = () => import('../../views/accountManage/pages/electronicReceipt/EReceiptVerify/EReceiptVerifyDetail.vue')
export default [
// 转账
{
path: '/accountManage',
component: AccountManage,
meta: {
keepAlive: false,
requiresAuth: false // 要求验证的页面, 在此情况下, 其子页面也会验证
},
children: [
{
path: '',
redirect: 'accountOverview'
},
{
path: 'transferDetail',
name: 'transferDetail',
component: transferDetail,
meta: {
keepAlive: true
}
},
]
}
]
在使用的页面
HTML
<div class="main-view">
<!-- keep-alive 是否缓存页面, 包括页面数据也会缓存下来, 在router中配置 -->
<keep-alive :include="keepAliveList">
<router-view v-if="$route.meta.keepAlive"/>
</keep-alive>
<router-view v-if="!$route.meta.keepAlive"/>
</div>
computed
computed: {
...mapState('ebank', {
keepAliveList: state => state.page.keepAliveList
})
},