发表于: 2020-02-27 22:36:09

1 1736



今天完成的事情:

1.推进任务


明天计划的事情:

1.推进任务


遇到的问题和收获:


created() {
   this.getDetails()
},
watch: {
   // '$route': 'getDetails'
   '$route'(to, from) {
       this.getDetails()


创建编辑组件和路由变化时都触发查询详情函数


getDetails() {
   if (this.$route.path === '/home/details/') {
       this.$http({
           method: 'get',
           url: '/api/a/article/' + this.$route.query.id,
           data: this.$qs.stringify(this.editInfo)
       }).then(res => {
           // console.log(res);
           if (res.data.code === 0) {
               console.log(res);
               this.article.title = res.data.data.article.title
               this.article.type = res.data.data.article.type
               this.article.status = res.data.data.article.status
               this.article.content = res.data.data.article.content
               this.article.url = res.data.data.article.url
               this.article.industry = res.data.data.article.industry
               // this.$http.get('/api/a/article' + row.id, this.editInfo)
               // this.$router.push({
               //     path: '/home/details'
               // })
           }
       })
   }
}


判断路由是不是要跳转的路由,然后再请求查询详情接口。


不过就是有点慢,还会闪过上一次点了编辑后查询的记录。



类型暂不知转为文字,图片没显示



返回列表 返回列表
评论

    分享到