fix(接口测试): 修复接口环境显示变量问题

--bug=1034069 --user=王孝刚 【接口测试】api、case、场景自定义请求通过后置脚本设置环境变量-执行成功第一次查看环境变量未显示 https://www.tapd.cn/55049933/s/1448742
This commit is contained in:
wxg0103 2023-12-27 15:47:06 +08:00 committed by Craftsman
parent 08347de201
commit 7ab9c9d628
1 changed files with 238 additions and 236 deletions

View File

@ -32,7 +32,8 @@
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="exportApi">{{
$t("envrionment.export_variable_tip")
}}</el-dropdown-item>
}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
@ -331,7 +332,7 @@ export default {
watch: {
items: {
handler(v) {
this.sortParameters();
this.initData(v);
},
immediate: true,
deep: true,
@ -768,23 +769,24 @@ export default {
handleExportCommand(command) {
this.exportJSON();
},
},
created() {
if (this.items.length === 0) {
this.items.push(new KeyValue({ enable: true, scope: "api" }));
initData(v) {
if (v.length === 0) {
v.push(new KeyValue({enable: true, scope: "api"}));
} else {
// api
forEach(this.items, (item) => {
forEach(v, (item) => {
delete item.hidden;
if (!item.scope) {
this.$set(item, "scope", "api");
}
});
this.allData = this.items;
this.allData = v;
this.sortParameters();
this.queryPage();
}
}
},
};
</script>