<template>
  <json-editor-vue
      class="editor"
      language="zh-CN"
      v-model="data"
      :currentMode="currentMode"
      :options="options"
      @change="changeJson"
  />
</template>

<script setup>
import {ref} from "vue";
import JsonEditorVue from 'json-editor-vue3'

const {proxy} = getCurrentInstance();

const options = ref({})

const props = defineProps({
  data: {
    required: true,
    type: Object
  },
  currentMode: {
    required: false,
    type: String,
    default: "code"
  }
})

function changeJson() {
  proxy.$emit("changeJson", props.data);
}
</script>

<style lang="scss">
.editor {
  height: 350px;
}

.jsoneditor-menu {
  //display: none;
  background-color: #b1b3b8;
}
</style>