发表于: 2020-05-02 22:13:55

1 1934



今天完成的事情:

1.推进任务


明天计划的事情:

1.推进任务


遇到的问题和收获:

路由变化to



还在想怎么优化比较好。路由变化会请求获取列表,点击搜索也会获取。所以点击时会请求2次。


watch: {
   // 如果路由有变化,会再次执行该方法
   '$route'(to, from) {

       this.queryInfo.size = this.$route.query.numPage ? this.$route.query.numPage : 5
       this.queryInfo.page = this.$route.query.currentPage ? this.$route.query.currentPage : 1
       this.queryInfo.type = this.$route.query.type
       this.queryInfo.status = this.$route.query.status
       this.queryInfo.startAt = this.$route.query.startAt
       this.queryInfo.endAt = this.$route.query.endAt
       console.log('路由变化');
       console.log(this.queryInfo.page);
       console.log(to);
            if (to.path === '/home/admin') {
                   this.getArticleList()    
   }







返回列表 返回列表
评论

    分享到