fix(接口自动化): 修改转换方法
This commit is contained in:
parent
199327be75
commit
4b5e4bbea9
|
@ -57,6 +57,7 @@
|
|||
methods: {
|
||||
handleClick() {
|
||||
if (this.activeName === 'preview') {
|
||||
console.log(this.schema)
|
||||
this.preview = schemaToJson(json5.parse(JSON.stringify(this.schema)));
|
||||
}
|
||||
},
|
||||
|
@ -64,10 +65,7 @@
|
|||
this.$refs.importJson.openOneClickOperation();
|
||||
},
|
||||
jsonData(data) {
|
||||
let obj =
|
||||
{
|
||||
"root": data
|
||||
}
|
||||
let obj = {"root": data}
|
||||
this.schema = obj;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,11 @@ const jsf = require('json-schema-faker');
|
|||
jsf.extend('mock', function () {
|
||||
return {
|
||||
mock: function (xx) {
|
||||
if (xx && xx.startsWith("@")) {
|
||||
return Mock.mock(xx);
|
||||
}
|
||||
return xx;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
created() {
|
||||
if (this.schema.mock && Object.prototype.toString.call(this.schema.mock).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
|
||||
this.mock = this.schema.mock;
|
||||
} else {
|
||||
this.schema.mock = this.mock;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
Loading…
Reference in New Issue