Showing
3 changed files
with
5 additions
and
8 deletions
| @@ -96,7 +96,7 @@ | @@ -96,7 +96,7 @@ | ||
| 96 | await nextTick(); | 96 | await nextTick(); |
| 97 | const jsCode = aceEditor.value.getValue(); | 97 | const jsCode = aceEditor.value.getValue(); |
| 98 | const res = getRestData.value ?? props.restData; | 98 | const res = getRestData.value ?? props.restData; |
| 99 | - const fn = new Function('data', 'res', jsCode)(res?.data, res); | 99 | + const fn = new Function('res', jsCode)(res); |
| 100 | emits('changeAceContent', fn); | 100 | emits('changeAceContent', fn); |
| 101 | } catch (error) { | 101 | } catch (error) { |
| 102 | return `过滤函数错误,日志:${error}`; | 102 | return `过滤函数错误,日志:${error}`; |
| @@ -236,9 +236,9 @@ | @@ -236,9 +236,9 @@ | ||
| 236 | send(JSON.stringify(socketMessage.sendValue)); | 236 | send(JSON.stringify(socketMessage.sendValue)); |
| 237 | }, | 237 | }, |
| 238 | onMessage(_, e) { | 238 | onMessage(_, e) { |
| 239 | - const { data } = JSON.parse(e.data); | ||
| 240 | - getRestData.value = data; | ||
| 241 | - commonRest(data, jsonEditorRef.value?.setJsonValue); | 239 | + const rest = JSON.parse(e.data); |
| 240 | + getRestData.value = rest; | ||
| 241 | + commonRest(rest, jsonEditorRef.value?.setJsonValue); | ||
| 242 | }, | 242 | }, |
| 243 | onDisconnected() { | 243 | onDisconnected() { |
| 244 | close(); | 244 | close(); |
| @@ -166,10 +166,7 @@ export const useUtils = () => { | @@ -166,10 +166,7 @@ export const useUtils = () => { | ||
| 166 | } else if (typeof data === 'string') { | 166 | } else if (typeof data === 'string') { |
| 167 | fn(data); | 167 | fn(data); |
| 168 | } else if (Array.isArray(data)) { | 168 | } else if (Array.isArray(data)) { |
| 169 | - const temp = { | ||
| 170 | - data, | ||
| 171 | - }; | ||
| 172 | - fn(temp); | 169 | + fn(data); |
| 173 | } else { | 170 | } else { |
| 174 | fn(JSON.stringify(data)); | 171 | fn(JSON.stringify(data)); |
| 175 | } | 172 | } |