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