From 1d1eaaece8ba5ebe4bd005a2616da1f51a0248ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=BE=E5=BF=97=E4=BC=9F?= <2405015284@qq.com> Date: Mon, 8 Apr 2024 15:25:25 +0800 Subject: [PATCH] fix --- package.json | 2 +- src/components/CodeEditor.vue | 5 +++++ src/views/HomeView.vue | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ff68e8c..d00cd94 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@easily-tools/mock-server-web", - "version": "1.0.1", + "version": "1.0.2", "files": [ "dist" ], diff --git a/src/components/CodeEditor.vue b/src/components/CodeEditor.vue index 4ea6575..ec0ac2e 100644 --- a/src/components/CodeEditor.vue +++ b/src/components/CodeEditor.vue @@ -84,6 +84,11 @@ onMounted(() => { }); } + // 如果是ts,添加全员变量 + if(props.language === 'typescript') { + monaco.languages.typescript.typescriptDefaults.addExtraLib(`declare const pathParams: string[];`); + } + // 数据绑定 monacoEditor.getModel()?.onDidChangeContent(() => { const value = monacoEditor.getValue(); diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index c5a66a1..596b71a 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -168,7 +168,7 @@ const handleSearch = (param: any) => { // 保存迭代期列表 const handleIterationListChange = async (list: string[]) => { - const res = await saveIterationList(list); + const res = await saveIterationList({list}); if (res.code !== 200) { ElMessage.error(`${t('global.save')}${t('global.iteration')}: ${t('global.fail')}`); } @@ -203,6 +203,8 @@ const handleMockItemSceneOperation = async (operation: string, mockItemBasicInfo name: t('global.sceneName'), iteration: iterationList.value[0] ?? '', param: '{\r\n \r\n}', + requestMethod: 'GET', + type: 'HTTP', responseConf: 'export default (param: any) => {\r\n \r\n}', }; isShowCodeEditor.value = true; @@ -247,6 +249,7 @@ const handleMockItemSceneOperation = async (operation: string, mockItemBasicInfo // 保存场景 const handleSaveSceneItem = async (isCloseCodeEditor = false) => { + console.log('some00000000', {...currentEditingSceneItem.value, mockItemId: currentEditingMockItemBaseInfo.value.id}) const res = await saveSceneItem({ ...currentEditingSceneItem.value, mockItemId: currentEditingMockItemBaseInfo.value.id, @@ -255,6 +258,7 @@ const handleSaveSceneItem = async (isCloseCodeEditor = false) => { ElMessage.success(`${t('global.save')}: ${t('global.success')}`); const item = res.data.find((item: any) => item.id === currentEditingSceneItem.value.id); if (item) { + console.log('some-----', res); currentEditingSceneItem.value = item; } if (isCloseCodeEditor) {