wujingjing
2025-02-17 0f01c4bbce19fa8489a4e835c83cb9415549f681
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<template>
    <JsonEditorVue
        v-bind="$attrs"
        language="zh-CN"
        :options="{
            search: false,
        }"
    />
</template>
 
<script setup lang="ts">
import { computed } from 'vue';
import JsonEditorVue from 'json-editor-vue3';
 
const props = defineProps({
    showToolbar: {
        type: Boolean,
        default: false,
    },
    showChangeModes: {
        type: Boolean,
        default: false,
    },
});
 
const editorMenuDisplay = computed(() => (props.showToolbar ? 'block' : 'none'));
const editorModeDisplay = computed(() => (props.showChangeModes ? 'block' : 'none'));
</script>
<style scoped lang="scss">
:deep(.jsoneditor-menu) {
    display: v-bind(editorMenuDisplay);
}
 
:deep(.jsoneditor-modes) {
    display: v-bind(editorModeDisplay);
}
</style>