为了账号安全,请及时绑定邮箱和手机立即绑定

vue2.0 如何实现页面缓存

vue2.0 如何实现页面缓存

肥皂起泡泡 2019-02-03 23:30:56
数据请求,是通过点击上面的分类(所以分类共用一个数据请求页面),监控路由变化,只要路由变化就会请求数据,这样的话页面请求的数据就缓存不了watch: {     $route: function() {      // if (this.routerChange) {         this.getNews()      // }     }   },   methods: {     ...mapActions(['getList', 'dowmLoadmore']),     getFirstNews(){      this.getList({         channel: this.firstName,         type: this.firstType,         flag: this.routerChange       })     },     getNews() {      this.getList({           channel: this.$route.query.type,           type: this.$route.params.type,           flag: this.routerChange         })keep-alive也开启了{       path: '/header',       name: 'Header',       component: Header,       meta:{  keepAlive: false },       children: [         {           path: '/home/:type',           name: 'Home',           component: Home,           meta:{  keepAlive: true  }         }       ]     },现在还是只要切换分类,页面就会刷新,不知道该怎么改了
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 1275 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信