fix(接口测试): 修复api测试后更新接口刷新问题

--bug=1009997 --user=赵勇 【接口测试】接口定义-test,更新接口没有及时刷新 https://www.tapd.cn/55049933/s/1099254
This commit is contained in:
fit2-zhao 2022-01-26 15:52:46 +08:00 committed by song-tianyang
parent e1c614b6d7
commit 4374f42aa3
1 changed files with 260 additions and 236 deletions

View File

@ -329,14 +329,38 @@
this.showMock = true; this.showMock = true;
this.$store.state.currentApiCase = undefined; this.$store.state.currentApiCase = undefined;
} else { } else {
this.syncApi();
}
},
changeApi() {
this.showApiList = true; this.showApiList = true;
this.showTestCaseList = false; this.showTestCaseList = false;
this.showTest = false; this.showTest = false;
this.showMock = false; this.showMock = false;
this.$store.state.currentApiCase = undefined; this.$store.state.currentApiCase = undefined;
}
}
}, },
syncApi() {
if (this.syncTabs && this.syncTabs.length > 0 && this.syncTabs.includes(this.currentApi.id)) {
//
let url = "/api/definition/get/";
this.$get(url + this.currentApi.id, response => {
if (response.data) {
let request = JSON.parse(response.data.request);
let index = this.syncTabs.findIndex(item => {
if (item === this.currentApi.id) {
return true;
}
});
this.syncTabs.splice(index, 1);
this.currentApi.request = request;
this.changeApi();
}
});
} else {
this.changeApi();
}
}
}
}; };
</script> </script>