Showing
3 changed files
with
5 additions
and
8 deletions
| ... | ... | @@ -96,7 +96,7 @@ |
| 96 | 96 | await nextTick(); |
| 97 | 97 | const jsCode = aceEditor.value.getValue(); |
| 98 | 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 | 100 | emits('changeAceContent', fn); |
| 101 | 101 | } catch (error) { |
| 102 | 102 | return `过滤函数错误,日志:${error}`; | ... | ... |
| ... | ... | @@ -236,9 +236,9 @@ |
| 236 | 236 | send(JSON.stringify(socketMessage.sendValue)); |
| 237 | 237 | }, |
| 238 | 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 | 243 | onDisconnected() { |
| 244 | 244 | close(); | ... | ... |
| ... | ... | @@ -166,10 +166,7 @@ export const useUtils = () => { |
| 166 | 166 | } else if (typeof data === 'string') { |
| 167 | 167 | fn(data); |
| 168 | 168 | } else if (Array.isArray(data)) { |
| 169 | - const temp = { | |
| 170 | - data, | |
| 171 | - }; | |
| 172 | - fn(temp); | |
| 169 | + fn(data); | |
| 173 | 170 | } else { |
| 174 | 171 | fn(JSON.stringify(data)); |
| 175 | 172 | } | ... | ... |