瀏覽代碼

try catch接口

wangziqian 5 年之前
父節點
當前提交
58ea0b37f9
共有 1 個文件被更改,包括 10 次插入6 次删除
  1. 10 6
      src/views/projectManage/taskList/childrenTask/childrenList.vue

+ 10 - 6
src/views/projectManage/taskList/childrenTask/childrenList.vue

@@ -110,13 +110,17 @@ export default {
         psgeSize: this.pages.pageSize,
         curIndex: this.pages.curIndex
       }
-      const res = await getSubTaskList(param)
-      if (res.code === 200) {
-        this.total = res.total
+      try {
+        const res = await getSubTaskList(param)
+        if (res.code === 200) {
+          this.total = res.total
+          this.loading = false
+          this.all_task = res.data.map(item => {
+            return { ...item, participants: item.participants.split(',') }
+          })
+        }
+      } catch (error) {
         this.loading = false
-        this.all_task = res.data.map(item => {
-          return { ...item, participants: item.participants.split(',') }
-        })
       }
     },
     async getTaskStatus() { // 获取任务状态列表