App.vue

<keep-alive>

    <router-view v-if="$route.meta.keepAlive"></router-view>

</keep-alive>

<router-view v-if="!$route.meta.keepAlive"></router-view>

Index.js路由

  list

{
    path: '/list',
    name: 'list',
    component: List,
    meta: {
      requiresAuth: true,
      privilege: ['capacityStatus'],
      keepAlive: true,//此组件需要被缓存
      isBack: false, //用于判断上一个页面是哪个
    }
  }

  details

  {
    path: '/details',
    name: 'details',
    component: Details,
    meta: {
      requiresAuth: true,
      privilege: ['capacityStatus'],
    }
  }

 

posted on 2020-06-14 12:17  琦琦怪怪  阅读(1296)  评论(0编辑  收藏  举报