首先在router.js中的列表页中添加缓存的变量:
{
path: '/',
name: 'home', // 列表页
component: home,
meta: {
keepAlive: true //此页面需要缓存
}
}
在列表详情页中添加缓冲变量(列表详情页视图不需要缓冲的话不用添加)
{
path: '/notedetail',
name: 'noteDetail',
component: notedetail,
meta: {
keepAlive: true