Skip to content

Commit

Permalink
fix: json 格式有误时没有错误提示的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hellosean1025 committed Apr 16, 2018
1 parent 4357ce2 commit e41b75f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dist/main.js

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions package/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,21 @@ class jsonSchema extends React.Component {
visible: true
});
};
handleOk = () => {
this.setState({ visible: false });
handleOk = () => {
if (this.importJsonType !== 'schema') {
if (!this.jsonData) return;
if (!this.jsonData) {
return message.error('json 数据格式有误')
};

let jsonData = GenerateSchema(this.jsonData);
this.Model.changeEditorSchemaAction({value: jsonData});
} else {
if (!this.jsonSchemaData) return;
if (!this.jsonSchemaData){
return message.error('json 数据格式有误')
};
this.Model.changeEditorSchemaAction({value: this.jsonSchemaData});
}
this.setState({ visible: false });
};
handleCancel = () => {
this.setState({ visible: false });
Expand Down
2 changes: 1 addition & 1 deletion prd/src/index.js

Large diffs are not rendered by default.

0 comments on commit e41b75f

Please sign in to comment.