diff --git a/frontend/src/business/components/api/definition/components/ApiVariable.vue b/frontend/src/business/components/api/definition/components/ApiVariable.vue index b2c9036b05..340ddde6a5 100644 --- a/frontend/src/business/components/api/definition/components/ApiVariable.vue +++ b/frontend/src/business/components/api/definition/components/ApiVariable.vue @@ -64,9 +64,9 @@ - - - + + + @@ -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' + })); + } } } } diff --git a/frontend/src/business/components/api/definition/components/body/ApiBody.vue b/frontend/src/business/components/api/definition/components/body/ApiBody.vue index 28426afe95..2e42b00377 100644 --- a/frontend/src/business/components/api/definition/components/body/ApiBody.vue +++ b/frontend/src/business/components/api/definition/components/body/ApiBody.vue @@ -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'; + } + }); + } } } diff --git a/frontend/src/business/components/api/definition/model/JsonData.js b/frontend/src/business/components/api/definition/model/JsonData.js index 9a1f8d2d1d..6be18968cf 100644 --- a/frontend/src/business/components/api/definition/model/JsonData.js +++ b/frontend/src/business/components/api/definition/model/JsonData.js @@ -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 = [