|
|
@ -9,6 +9,14 @@ const emit = defineEmits(['update:modelValue']) |
|
|
|
const root = ref<HTMLDivElement>() |
|
|
|
const root = ref<HTMLDivElement>() |
|
|
|
let editor: monaco.editor.IStandaloneCodeEditor |
|
|
|
let editor: monaco.editor.IStandaloneCodeEditor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const format = () => { |
|
|
|
|
|
|
|
editor.setValue(JSON.stringify(JSON.parse(editor?.getValue() as string), null, 2)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defineExpose({ |
|
|
|
|
|
|
|
format, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|
if (root.value) { |
|
|
|
if (root.value) { |
|
|
|
const model = monaco.editor.createModel(JSON.stringify(modelValue, null, 2), 'json') |
|
|
|
const model = monaco.editor.createModel(JSON.stringify(modelValue, null, 2), 'json') |
|
|
|