fix(1.4.0-beta1): 修复代码编辑器格式化问题

This commit is contained in:
xlsea 2025-02-25 14:25:53 +08:00
parent 960c27ab04
commit d31dd100d6

View File

@ -106,14 +106,16 @@ const theme = computed(() => {
watch( watch(
() => nodeExpression.value, () => nodeExpression.value,
val => { () => {
let value = val;
if (props.lang === 'json') { if (props.lang === 'json') {
try { try {
value = JSON.stringify(JSON.parse(val)); const obj = JSON.parse(nodeExpression.value);
if (typeof obj === 'object') {
nodeExpression.value = JSON.stringify(obj);
}
} catch {} } catch {}
} }
emit('update:modelValue', value); emit('update:modelValue', nodeExpression.value);
} }
); );
</script> </script>