From 541b01a1d11a6c2bc13d3fead696d607b354cd1a Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Tue, 12 Apr 2022 18:05:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dkey-value=E5=8F=82=E6=95=B0=E4=B8=AD=E5=BD=93?= =?UTF-8?q?=E5=BB=BA=E5=80=BC=E5=AF=B9=E5=85=A8=E9=83=A8=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E4=BC=9A=E4=B8=BB=E5=8A=A8=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E6=95=B0=E6=8D=AE=E8=A1=8C=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1012000 --user=宋天阳 rest 参数删除后保存,标签那里数字没有清空 https://www.tapd.cn/55049933/s/1133353 --- .../api/definition/components/ApiVariable.vue | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/src/business/components/api/definition/components/ApiVariable.vue b/frontend/src/business/components/api/definition/components/ApiVariable.vue index dafd9e9e03..374b45bbdb 100644 --- a/frontend/src/business/components/api/definition/components/ApiVariable.vue +++ b/frontend/src/business/components/api/definition/components/ApiVariable.vue @@ -192,9 +192,21 @@ export default { }, change: function () { let isNeedCreate = true; + let removeIndexArr = []; + this.parameters.forEach((item, index) => { + if ((!item.name || item.name === '' ) && (!item.value || item.value === '') && (!item.files || item.files.length === 0)) { + // 多余的空行 + removeIndexArr.push(index); + } + }); + if(removeIndexArr.length > 0){ + for(let i = removeIndexArr.length-1; i>=0; i--){ + this.remove(removeIndexArr[i]); + } + } let removeIndex = -1; this.parameters.forEach((item, index) => { - if (!item.name && !item.value) { + if ((!item.name || item.name === '' ) && (!item.value || item.value === '') && (!item.files || item.files.length === 0)) { // 多余的空行 if (index !== this.parameters.length - 1) { removeIndex = index; @@ -203,6 +215,7 @@ export default { isNeedCreate = false; } }); + if (isNeedCreate) { this.parameters.push(new KeyValue({ type: 'text',