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() { async function handleUseEnvChange() {
const pluginId = protocolOptions.value.find((e) => e.value === requestVModel.value.protocol)?.pluginId; if (!isHttpProtocol.value) {
const res = await getPluginScript(pluginId); const pluginId = protocolOptions.value.find((e) => e.value === requestVModel.value.protocol)?.pluginId;
pluginScriptMap.value[requestVModel.value.protocol] = res; const res = await getPluginScript(pluginId);
fApi.value?.nextTick(() => { pluginScriptMap.value[requestVModel.value.protocol] = res;
controlPluginFormFields(); fApi.value?.nextTick(() => {
}); controlPluginFormFields();
nextTick(() => { });
// form-create tab nextTick(() => {
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) { // 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 { // } else {
requestVModel.value = { ...defaultDebugParams }; // requestVModel.value = { ...defaultDebugParams };
} // }
// }
// );
onBeforeMount(() => {
initProtocolList();
if (props.request) {
requestVModel.value = { ...defaultDebugParams, ...props.request };
handleActiveDebugProtocolChange(requestVModel.value.protocol);
} else {
requestVModel.value = { ...defaultDebugParams };
} }
); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>