|
@@ -60,19 +60,16 @@ onMounted(() => {
|
|
content.value = props.script! || emptyFunction
|
|
content.value = props.script! || emptyFunction
|
|
})
|
|
})
|
|
|
|
|
|
-function saveCode() {
|
|
|
|
|
|
+async function saveCode() {
|
|
const funStr = mirrorRef.value.getValue()
|
|
const funStr = mirrorRef.value.getValue()
|
|
|
|
|
|
if (funStr === '') {
|
|
if (funStr === '') {
|
|
return toSave(funStr)
|
|
return toSave(funStr)
|
|
}
|
|
}
|
|
|
|
|
|
- try {
|
|
|
|
- eval("(" + funStr + ")")
|
|
|
|
- toSave(funStr)
|
|
|
|
- } catch (error) {
|
|
|
|
- ElMessage.error('语法校验未通过')
|
|
|
|
- }
|
|
|
|
|
|
+ await validate()
|
|
|
|
+
|
|
|
|
+ toSave(funStr)
|
|
}
|
|
}
|
|
|
|
|
|
function toSave(data: string) {
|
|
function toSave(data: string) {
|