mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2026-07-09 00:00:04 +08:00
commit
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user