From f14946bd84b5e88a13328683395e0422aa16f9bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E4=B8=91=E8=B7=AF=E4=BA=BA?= <2278757482@qq.com> Date: Fri, 15 Jan 2021 14:59:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B4=A7=E6=80=A5=E4=BF=AE=E5=A4=8D=EF=BC=9A?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E7=AB=A0=EF=BC=8C=E6=9C=AA=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=96=87=E7=AB=A0=E5=88=86=E7=B1=BB=E7=9A=84BUG?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../articles/components/ArticleDetail.vue | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/app/Modules/Admin/Resources/vue-element-admin/views/articles/components/ArticleDetail.vue b/app/Modules/Admin/Resources/vue-element-admin/views/articles/components/ArticleDetail.vue index ab13a4e..02b3e2d 100644 --- a/app/Modules/Admin/Resources/vue-element-admin/views/articles/components/ArticleDetail.vue +++ b/app/Modules/Admin/Resources/vue-element-admin/views/articles/components/ArticleDetail.vue @@ -250,21 +250,26 @@ // 因为下拉tree是需要先获取数据,进行数据对比,拿到当前选中的值,所以需要:获取文章详情之后,再去获取文章分类。 if (this.isEdit) { const article_id = this.$route.query && this.$route.query.article_id; - if (article_id > 0) this.getDetail(article_id, function () { - // 文章分类列表 - _this.getCategorySelect(function () { - try{ - _this.category.forEach(item => { - if(item.category_id == _this.postForm.category_id){ - _this.select_category_name = item.category_name; - throw new Error("end……对比成功");//报错,就跳出循环 - } - }); - }catch (e) { - // console.log(e); - } + if (article_id > 0){ + this.getDetail(article_id, function () { + // 文章分类列表 + _this.getCategorySelect(function () { + try{ + _this.category.forEach(item => { + if(item.category_id == _this.postForm.category_id){ + _this.select_category_name = item.category_name; + throw new Error("end……对比成功");//报错,就跳出循环 + } + }); + }catch (e) { + // console.log(e); + } + }); }); - }); + }else{ + // 文章分类列表 + this.getCategorySelect(); + } }else{ // 文章分类列表 this.getCategorySelect(); @@ -314,6 +319,7 @@ }, // 获取文章分类列表 async getCategorySelect(callback) { + console.log('getCategorySelect') const res = await getCategorySelect(); this.category = res.data; if (callback) callback(); -- Gitee