refactor: 环境变量添加描述和复制功能

This commit is contained in:
chenjianxing 2021-01-20 13:44:21 +08:00
parent 0123e7ae74
commit 73d63ce072
1 changed files with 16 additions and 2 deletions

View File

@ -4,7 +4,7 @@
{{description}}
</span>
<div class="kv-row" v-for="(item, index) in items" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-row type="flex" :gutter="5" justify="space-between" align="middle">
<el-col class="kv-checkbox">
<input type="checkbox" v-if="!isDisable(index)" @change="change" :value="item.uuid" v-model="item.enable"
:disabled="isDisable(index) || isReadOnly"/>
@ -18,6 +18,15 @@
<el-input :disabled="isReadOnly" v-model="item.value" size="small" @change="change"
:placeholder="$t('api_test.value')" show-word-limit/>
</el-col>
<el-col>
<el-input v-model="item.description" size="small" maxlength="200"
:placeholder="$t('commons.description')" show-word-limit>
</el-input>
</el-col>
<el-col class="kv-copy">
<el-button size="mini" class="el-icon-document-copy" circle @click="copy(item, index)"
:disabled="isDisable(index) || isReadOnly"/>
</el-col>
<el-col class="kv-delete">
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"
:disabled="isDisable(index) || isReadOnly"/>
@ -59,6 +68,11 @@
this.items.splice(index, 1);
this.$emit('change', this.items);
},
copy: function (item, index) {
let copy = {};
Object.assign(copy, item);
this.items.splice(index + 1, 0, copy);
},
change: function () {
let isNeedCreate = true;
let removeIndex = -1;
@ -105,7 +119,7 @@
margin-top: 10px;
}
.kv-delete {
.kv-delete,.kv-copy {
width: 60px;
}
</style>