新增EVAL代码

This commit is contained in:
fofolee 2025-02-22 11:03:26 +08:00
parent 1fe478f373
commit d9bc4b4f34
2 changed files with 27 additions and 6 deletions

View File

@ -1,5 +1,5 @@
<template>
<div class="code-editor" :style="{ height: height }">
<div class="code-editor" :style="{ height: height + 'px' }">
<div
class="editor-container"
:style="{
@ -90,8 +90,8 @@ export default defineComponent({
},
//
height: {
type: String,
default: "300px",
type: Number,
default: 300,
},
//
theme: {

View File

@ -4,21 +4,42 @@ export const scriptCommands = {
commands: [
{
value: "injectJs",
label: "注入JS代码",
label: "注入代码",
icon: "script",
description: "注入的代码js将在流程对应的位置直接运行。",
neverHasOutput: true,
isExpression: true,
config: [
{
label: "JS脚本",
component: "CodeEditor",
language: "quickcommand",
placeholder:
"共享当前上下文支持utoolsquickcommandquickcomposer等接口",
"和当前流程共享上下文变量、函数等支持utools、quickcommand、quickcomposer、nodejs的接口",
width: 12,
},
],
},
{
value: `((code) => {return new Function("return " + code)()})`,
label: "eval代码",
description: "eval代码js并返回结果",
config: [
{
component: "CodeEditor",
language: "quickcommand",
height: 40,
hasAIAssistant: false,
placeholder:
"和当前流程共享上下文变量、函数等支持utools、quickcommand、quickcomposer、nodejs的接口。",
width: 12,
},
],
outputs: {
label: "结果",
suggestName: "evalResult",
typeName: "字符串",
},
},
{
value: "quickcommand.runCode",
label: "运行脚本",