fix(接口定义): 修复导入API 编辑问题

This commit is contained in:
fit2-zhao 2020-12-17 15:02:39 +08:00
parent 9d9f949414
commit 3dda8e849d
3 changed files with 28 additions and 18 deletions

View File

@ -64,9 +64,9 @@
</el-col>
<!--<el-col v-if="type === 'body'" class="kv-select">-->
<!--<el-input :disabled="isReadOnly" v-model="item.contentType" size="small"-->
<!--@change="change" :placeholder="$t('api_test.request.content_type')" show-word-limit>-->
<!--</el-input>-->
<!--<el-input :disabled="isReadOnly" v-model="item.contentType" size="small"-->
<!--@change="change" :placeholder="$t('api_test.request.content_type')" show-word-limit>-->
<!--</el-input>-->
<!--</el-col>-->
<el-col class="kv-delete">
@ -199,14 +199,16 @@
}
},
created() {
if (this.parameters.length === 0 || this.parameters[this.parameters.length - 1].name) {
this.parameters.push(new KeyValue({
type: 'text',
enable: true,
required: true,
uuid: this.uuid(),
contentType: 'text/plain'
}));
if (this.parameters) {
if (this.parameters.length === 0 || this.parameters[this.parameters.length - 1].name) {
this.parameters.push(new KeyValue({
type: 'text',
enable: true,
required: true,
uuid: this.uuid(),
contentType: 'text/plain'
}));
}
}
}
}

View File

@ -182,11 +182,13 @@
if (!this.body.type) {
this.body.type = BODY_TYPE.FORM_DATA;
}
this.body.kvs.forEach(param => {
if (!param.type) {
param.type = 'text';
}
});
if (this.body.kvs) {
this.body.kvs.forEach(param => {
if (!param.type) {
param.type = 'text';
}
});
}
}
}
</script>

View File

@ -18,7 +18,7 @@ export const DEFAULT_DATA = [{
"name": "回收站",
"level": 1,
"children": [],
},{
}, {
"id": "root",
"name": "全部模块",
"level": 0,
@ -27,7 +27,13 @@ export const DEFAULT_DATA = [{
export const REQ_METHOD = [
{id: 'GET', label: 'GET'},
{id: 'POST', label: 'POST'}
{id: 'POST', label: 'POST'},
{id: 'PUT', label: 'PUT'},
{id: 'PATCH', label: 'PATCH'},
{id: 'DELETE', label: 'DELETE'},
{id: 'OPTIONS', label: 'OPTIONS'},
{id: 'HEAD', label: 'HEAD'},
{id: 'CONNECT', label: 'CONNECT'}
]
export const API_STATUS = [