From 10d7ab200e57ab006f6521ce55fca2c86507b40f Mon Sep 17 00:00:00 2001 From: fofolee Date: Mon, 4 Mar 2024 16:42:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BD=AC=E4=B9=89=E8=A7=84?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CommandRunResult.vue | 40 +++++++++++++++++++---------- src/js/options/specialVars.js | 10 ++------ 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/components/CommandRunResult.vue b/src/components/CommandRunResult.vue index 44315b9..d766622 100644 --- a/src/components/CommandRunResult.vue +++ b/src/components/CommandRunResult.vue @@ -3,13 +3,13 @@ + maxWidth: fromUtools ? '100%' : '700px', + width: fromUtools ? '100%' : '700px', + overflow: 'hidden', + }">
+ height: headerHeight + 'px', + }" class="flex items-center justify-between">
+ height: headerHeight + 'px', + }" />
this.escapeChars(val.repl(x, replData))); + cmd = cmd.replace(val.match, (x) => this.escapeItem(val.repl(x, replData))); } }); return cmd; diff --git a/src/js/options/specialVars.js b/src/js/options/specialVars.js index 731aa8b..5c57675 100644 --- a/src/js/options/specialVars.js +++ b/src/js/options/specialVars.js @@ -2,17 +2,11 @@ * 所有的特殊变量 */ -let escapeItem = item => { - if (typeof item === 'number') return item - item = typeof item === 'object' ? JSON.stringify(item) : item.replace(/\\/g, '\\\\') - return item.replace('$', '$$$') -} - let handlingJsonVar = (jsonVar, name, payload) => { try { - return escapeItem(window.evalCodeInSandbox(jsonVar.slice(2, -2), { + return window.evalCodeInSandbox(jsonVar.slice(2, -2), { [name]: payload - })) + }) } catch (e) { return utools.showNotification(e) }