mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-06-19 04:01:33 +08:00
fix(editor): code-editor组件json类型序列化出错
This commit is contained in:
parent
5b3c700f00
commit
2d4a6aa22a
@ -37,10 +37,14 @@ const emit = defineEmits(['initd', 'save']);
|
|||||||
const toString = (v: string | any, language: string): string => {
|
const toString = (v: string | any, language: string): string => {
|
||||||
let value = '';
|
let value = '';
|
||||||
if (typeof v !== 'string') {
|
if (typeof v !== 'string') {
|
||||||
value = serialize(v, {
|
if (props.language.toLocaleLowerCase() === 'json') {
|
||||||
space: 2,
|
value = JSON.stringify(v, null, 2);
|
||||||
unsafe: true,
|
} else {
|
||||||
}).replace(/"(\w+)":\s/g, '$1: ');
|
value = serialize(v, {
|
||||||
|
space: 2,
|
||||||
|
unsafe: true,
|
||||||
|
}).replace(/"(\w+)":\s/g, '$1: ');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
value = v;
|
value = v;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user