Explorar o código

fix: 产品详情的数据解析的校验

yanglzh hai 1 ano
pai
achega
9f11f59bb5
Modificáronse 1 ficheiros con 4 adicións e 7 borrados
  1. 4 7
      src/views/iot/device/product/component/dataParse.vue

+ 4 - 7
src/views/iot/device/product/component/dataParse.vue

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