Skip to content

Commit

Permalink
Merge pull request #5 from warriorBrian/fix/change-error
Browse files Browse the repository at this point in the history
修复change事件在编辑模式下报错捕获
  • Loading branch information
warriorBrian authored Mar 5, 2021
2 parents daa712b + f759255 commit 9525a3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "v-json-edit",
"description": "vue json editor components",
"version": "0.7.0",
"version": "0.8.0",
"main": "src/index.js",
"author": "Brian",
"license": "MIT",
Expand Down
8 changes: 6 additions & 2 deletions src/Json-edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,12 @@ export default {
history: _self.history,
search: _self.search,
onChange () {
const data = _self.editor.get()
_self.$emit('change', data)
try {
const data = _self.editor.get()
_self.$emit('change', data)
} catch (e) {
_self.$emit('on-error', e)
}
},
onModeChange (newMode, oldMode) {
_self.$emit('on-mode', { newMode, oldMode })
Expand Down

0 comments on commit 9525a3d

Please sign in to comment.