Skip to content

Commit

Permalink
Porting josdejong/svelte-jsoneditor#166 (comment) to Vue3 json editor
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliohome committed Apr 11, 2024
1 parent d220d86 commit 2dbd3f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const switchCondition = () => {
const printJSON = () => {
console.log(typeof(myJSON.value))
}
const updatedContent = (myupdate: any) => {
console.log("my update", myupdate);
myupdate.json = JSON.parse(myupdate.text);
myupdate.text = undefined
}
</script>

Expand All @@ -34,7 +39,7 @@ const printJSON = () => {
<button @click="printJSON">printJSON</button>

<div v-if="switchMe" > read only</div>
<JsonEditorVue v-else v-model="myJSON" />
<JsonEditorVue v-else v-model="myJSON" :onChange="updatedContent" />
<span>{{ typeof(myJSON) }}</span>

</div>
Expand Down

0 comments on commit 2dbd3f6

Please sign in to comment.