fix(接口定义): JSON-SCHEMA转换问题修复
This commit is contained in:
parent
c1303bd8a8
commit
20f7e727ea
|
@ -31,7 +31,7 @@
|
|||
body: {},
|
||||
},
|
||||
created() {
|
||||
if (!this.body.jsonSchema && this.body.raw) {
|
||||
if (!this.body.jsonSchema && this.body.raw && this.checkIsJson(this.body.raw)) {
|
||||
let obj = {"root": GenerateSchema(JSON.parse(this.body.raw))}
|
||||
this.schema = obj;
|
||||
}
|
||||
|
@ -70,6 +70,14 @@
|
|||
openOneClickOperation() {
|
||||
this.$refs.importJson.openOneClickOperation();
|
||||
},
|
||||
checkIsJson(json) {
|
||||
try {
|
||||
JSON.parse(json);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
jsonData(data) {
|
||||
let obj = {"root": data}
|
||||
this.schema = obj;
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
json5.parse(json);
|
||||
return true;
|
||||
} catch (e) {
|
||||
alert(1);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -289,7 +289,6 @@
|
|||
for (const k in this.advancedValue) {
|
||||
if (this.pickValue[k]) this.advancedValue[k] = this.pickValue[k]
|
||||
}
|
||||
console.log(this.pickValue)
|
||||
},
|
||||
handleClose() {
|
||||
this.modalVisible = false;
|
||||
|
|
Loading…
Reference in New Issue