File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -125,16 +125,17 @@ export default defineComponent({
125
125
preventUpdatingContent . value = false
126
126
return
127
127
}
128
- preventUpdatingModelValue . value = true
129
- // `jsonEditor.value` could be `undefined` in Vue 2.6 (dev environment)
130
- jsonEditor . value ?. set (
131
- [ undefined , '' ] . includes ( newModelValue )
132
- // `undefined` is not accepted by vanilla-jsoneditor
133
- // The default value is `{ text: '' }`
134
- // Only default value can clear the editor
135
- ? { text : '' }
136
- : { json : newModelValue } ,
137
- )
128
+ if ( jsonEditor . value ) {
129
+ preventUpdatingModelValue . value = true
130
+ jsonEditor . value . set (
131
+ [ undefined , '' ] . includes ( newModelValue )
132
+ // `undefined` is not accepted by vanilla-jsoneditor
133
+ // The default value is `{ text: '' }`
134
+ // Only default value can clear the editor
135
+ ? { text : '' }
136
+ : { json : newModelValue } ,
137
+ )
138
+ }
138
139
} ,
139
140
{
140
141
deep : true ,
You can’t perform that action at this time.
0 commit comments