vue keepAlive:true 失效

 {
  path: '/information',
  name:"information",
  meta:{
    keepAlive:true 
  },
  component: function (resolve) {
  require(['@/view/personal/components/information/information'],         
  resolve)
  },
},


meta:{
    keepAlive:true 
},


页面不被缓存


阅读 2.8k
评论
    2 个回答
    asseek
    • 7.9k

    route设不设定mete有什么关系,vue又不会自动识别。重点是App.vue里面是否有根据路由mete进行keep-alive包裹呢?

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

    类似这样

    评论 赞赏
      <keep-alive>
          <router-view>这样使用</router-view>
      </keep-alive>
      评论 赞赏
        撰写回答

        登录后参与交流、获取后续更新提醒