fix(接口测试): 自定义请求页面初始化加载

This commit is contained in:
WangXu10 2024-03-21 11:59:44 +08:00 committed by 刘瑞斌
parent 9facfbabec
commit 5d64a05a91
1 changed files with 36 additions and 25 deletions

View File

@ -633,16 +633,17 @@
// 使
async function handleUseEnvChange() {
const pluginId = protocolOptions.value.find((e) => e.value === requestVModel.value.protocol)?.pluginId;
const res = await getPluginScript(pluginId);
pluginScriptMap.value[requestVModel.value.protocol] = res;
fApi.value?.nextTick(() => {
controlPluginFormFields();
});
nextTick(() => {
// form-create tab
fApi.value?.resetFields();
});
if (!isHttpProtocol.value) {
const pluginId = protocolOptions.value.find((e) => e.value === requestVModel.value.protocol)?.pluginId;
const res = await getPluginScript(pluginId);
pluginScriptMap.value[requestVModel.value.protocol] = res;
fApi.value?.nextTick(() => {
controlPluginFormFields();
});
nextTick(() => {
fApi.value?.resetFields();
});
}
}
const pluginError = ref(false);
@ -976,22 +977,32 @@
const showAddDependencyDrawer = ref(false);
const addDependencyMode = ref<'pre' | 'post'>('pre');
watch(
() => visible.value,
async (val) => {
if (val) {
await initProtocolList();
if (props.request) {
requestVModel.value = { ...defaultDebugParams, ...props.request };
handleActiveDebugProtocolChange(requestVModel.value.protocol);
} else {
requestVModel.value = { ...defaultDebugParams };
}
} else {
requestVModel.value = { ...defaultDebugParams };
}
// watch(
// () => visible.value,
// async (val) => {
// if (val) {
// await initProtocolList();
// if (props.request) {
// requestVModel.value = { ...defaultDebugParams, ...props.request };
// handleActiveDebugProtocolChange(requestVModel.value.protocol);
// } else {
// requestVModel.value = { ...defaultDebugParams };
// }
// } else {
// requestVModel.value = { ...defaultDebugParams };
// }
// }
// );
onBeforeMount(() => {
initProtocolList();
if (props.request) {
requestVModel.value = { ...defaultDebugParams, ...props.request };
handleActiveDebugProtocolChange(requestVModel.value.protocol);
} else {
requestVModel.value = { ...defaultDebugParams };
}
);
});
</script>
<style lang="less" scoped>