正在显示
1 个修改的文件
包含
10 行增加
和
2 行删除
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | <template #default> | 18 | <template #default> |
19 | <div style="display: flex;width: 300px;"> | 19 | <div style="display: flex;width: 300px;"> |
20 | <el-input v-model="item.name" style="min-width: 200px;"></el-input> | 20 | <el-input v-model="item.name" style="min-width: 200px;"></el-input> |
21 | - <el-button v-if="index>0" type="danger" style="margin-left: 20px;" @click="del(index)">删除</el-button> | 21 | + <el-button type="danger" style="margin-left: 20px;" @click="del(index)">删除</el-button> |
22 | </div> | 22 | </div> |
23 | </template> | 23 | </template> |
24 | </el-popover> | 24 | </el-popover> |
@@ -61,8 +61,16 @@ export default { | @@ -61,8 +61,16 @@ export default { | ||
61 | window.localStorage.setItem('kibana_key',this.useKey); | 61 | window.localStorage.setItem('kibana_key',this.useKey); |
62 | }, | 62 | }, |
63 | del(index){ | 63 | del(index){ |
64 | - if(this.items.length===1) return; | 64 | + // if(this.items.length===1) return; |
65 | this.items.splice(index,1); | 65 | this.items.splice(index,1); |
66 | + if(this.items.length===0){ | ||
67 | + this.add(); | ||
68 | + this.useKey = 0; | ||
69 | + return; | ||
70 | + } | ||
71 | + if(index === this.useKey){ | ||
72 | + this.useKey = index-1; | ||
73 | + } | ||
66 | }, | 74 | }, |
67 | add(){ | 75 | add(){ |
68 | this.items.push({ | 76 | this.items.push({ |
-
请 注册 或 登录 后发表评论