From 3dda8e849d593469465befc57f9233c18e1684d4 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 17 Dec 2020 15:02:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5API=20=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/definition/components/ApiVariable.vue | 24 ++++++++++--------- .../definition/components/body/ApiBody.vue | 12 ++++++---- .../api/definition/model/JsonData.js | 10 ++++++-- 3 files changed, 28 insertions(+), 18 deletions(-) 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 = [