This commit is contained in:
吕金泽
2021-10-24 20:09:53 +08:00
commit 4a7d1d08ac
509 changed files with 142640 additions and 0 deletions
@@ -0,0 +1,41 @@
<template>
<div ref="jsoneditor" style="height: 800px" />
</template>
<script>
import JSONEditor from 'jsoneditor/dist/jsoneditor.js'
import 'jsoneditor/dist/jsoneditor.css'
export default {
name: 'JsonEditor',
props: {
json: {
type: Object,
default: () => {}
},
options: {
type: Object,
default: () => {}
}
},
data() {
return {
editor: null
}
},
watch: {
json(newJson) {
if (this.editor) {
this.editor.destroy()
this.editor = new JSONEditor(this.$refs.jsoneditor, this.options, newJson)
}
}
},
mounted() {
this.editor = new JSONEditor(this.$refs.jsoneditor, this.options, this.json)
}
}
</script>
<style>
</style>