|
|
@ -5,11 +5,14 @@ import YvSrcEditor from "../components/YvSrcEditor.vue" |
|
|
|
|
|
|
|
|
const code = ref(` |
|
|
const code = ref(` |
|
|
|
|
|
|
|
|
|
|
|
log.info("测试打印日志,通过服务端控制台查看") |
|
|
const a = 111, b= 555; |
|
|
const a = 111, b= 555; |
|
|
const sum = (a + b); |
|
|
const sum = (a + b); |
|
|
print(a + "+" + b + " = " + sum); |
|
|
print(a + "+" + b + " = " + sum); |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
|
|
|
sum, |
|
|
|
|
|
date: new Date(), |
|
|
msg: "测试JS脚本", |
|
|
msg: "测试JS脚本", |
|
|
} |
|
|
} |
|
|
`); |
|
|
`); |
|
|
@ -19,9 +22,9 @@ const res = ref(""); |
|
|
function execute() { |
|
|
function execute() { |
|
|
Request.request.post("/api/workbench/JsDemo@runJs", { |
|
|
Request.request.post("/api/workbench/JsDemo@runJs", { |
|
|
jsCode: code.value, |
|
|
jsCode: code.value, |
|
|
}).then(data=> { |
|
|
}).then(data => { |
|
|
res.value = JSON.stringify(data, null, 4); |
|
|
res.value = JSON.stringify(data, null, 4); |
|
|
}).catch(()=> { |
|
|
}).catch(() => { |
|
|
res.value = "执行失败"; |
|
|
res.value = "执行失败"; |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|