修复双向绑定

This commit is contained in:
aixianling
2024-03-22 13:59:14 +08:00
parent c7b37d645d
commit 10b43594ca

View File

@@ -14,11 +14,6 @@ export default {
fullscreen: false
}
},
watch: {
value(v) {
this.editor.set(v)
}
},
methods: {
init() {
const {JSONEditor} = window
@@ -27,9 +22,9 @@ export default {
this.editor = new JSONEditor(this.$el, {
modes: ['code', 'form', 'tree'],
language: 'zh-CN', mode, search, mainMenuBar, navigationBar, statusBar: true,
onChangeJSON: json => {
this.$emit("input", json)
}
onChange: () => {
this.$emit("input", this.editor.get())
},
}, this.value)
} else setTimeout(() => this.init(), 500)
const fullscreenBtn = document.querySelector(".fullscreenBtn")