fix:修改 editendpoint字段使用错误 导致新增 key的值无法被保留的问题

This commit is contained in:
zhangyu
2020-11-10 16:33:05 +08:00
parent 8c89af5f92
commit 8a41b47794
4 changed files with 10 additions and 11 deletions

View File

@@ -485,7 +485,7 @@
this.inputKeyErr.splice(index, 1); this.inputKeyErr.splice(index, 1);
}, },
validateInput:function(value,index){ validateInput:function(value,index){
if(!/^[a-zA-Z_:][a-zA-Z0-9_:]*/.test(value)){ if(!/[a-zA-Z_:][a-zA-Z0-9_:]*/.test(value)){
this.inputKeyErr.splice(index,1,true) this.inputKeyErr.splice(index,1,true)
}else{ }else{
this.inputKeyErr.splice(index,1,false) this.inputKeyErr.splice(index,1,false)

View File

@@ -99,8 +99,8 @@
<div class="param-box param-box-module"> <div class="param-box param-box-module">
<el-scrollbar ref="labelBoxScrollbar" style="height: 100%"> <el-scrollbar ref="labelBoxScrollbar" style="height: 100%">
<div class="param-box-row" v-for="(item, index) in endpoint.labelModule"> <div class="param-box-row" v-for="(item, index) in editEndpoint.labelModule">
<el-form-item class="param-box-row-key" :rules="[{required: true, message: $t('validate.required'), trigger: 'blur'},{ pattern: /^[a-zA-Z_:][a-zA-Z0-9_:]*/, message: $t('validate.key') ,trigger: 'blur'}]" :prop="'labelModule.' + index + '.key'"> <el-form-item class="param-box-row-key" :rules="[{required: true, message: $t('validate.required'), trigger: 'blur'},{ pattern: /[a-zA-Z_:][a-zA-Z0-9_:]*/, message: $t('validate.key') ,trigger: 'blur'}]" :prop="'labelModule.' + index + '.key'">
<el-input placeholder="key" size="mini" v-model="item.key"></el-input> <el-input placeholder="key" size="mini" v-model="item.key"></el-input>
</el-form-item> </el-form-item>
<span class="param-box-row-eq">=</span> <span class="param-box-row-eq">=</span>
@@ -186,7 +186,7 @@
// 清除param // 清除param
clearAllParam() { clearAllParam() {
this.endpoint.paramObj = []; this.editEndpoint.paramObj = [];
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.paramBoxScrollbar.update(); this.$refs.paramBoxScrollbar.update();
}); });
@@ -194,7 +194,7 @@
// 新增param // 新增param
addParam() { addParam() {
this.endpoint.paramObj.push({key: '', value: ''}); this.editEndpoint.paramObj.push({key: '', value: ''});
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.paramBoxScrollbar.update(); this.$refs.paramBoxScrollbar.update();
}); });
@@ -202,7 +202,7 @@
// 移除单个param // 移除单个param
removeParam(index) { removeParam(index) {
this.endpoint.paramObj.splice(index, 1); this.editEndpoint.paramObj.splice(index, 1);
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.paramBoxScrollbar.update(); this.$refs.paramBoxScrollbar.update();
}); });
@@ -224,15 +224,14 @@
// 新增label // 新增label
addLabel() { addLabel() {
console.log(123123); this.editEndpoint.labelModule.push({key: '', value: ''});
this.endpoint.labelModule.push({key: '', value: ''});
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.labelBoxScrollbar.update(); this.$refs.labelBoxScrollbar.update();
}); });
}, },
// 移除单个Label // 移除单个Label
removeLabel(index) { removeLabel(index) {
this.endpoint.labelModule.splice(index, 1); this.editEndpoint.labelModule.splice(index, 1);
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.labelBoxScrollbar.update(); this.$refs.labelBoxScrollbar.update();
}); });

View File

@@ -283,7 +283,7 @@
<div class="param-box param-box-module"> <div class="param-box param-box-module">
<el-scrollbar ref="labelBoxScrollbar" style="height: 100%"> <el-scrollbar ref="labelBoxScrollbar" style="height: 100%">
<div class="param-box-row" v-for="(item, index) in editModule.labelModule"> <div class="param-box-row" v-for="(item, index) in editModule.labelModule">
<el-form-item class="param-box-row-key" :rules="[{required: true, message: $t('validate.required'), trigger: 'blur'},{ pattern: /^[a-zA-Z_:][a-zA-Z0-9_:]*/, message: $t('validate.key') ,trigger: 'blur'}]" :prop="'labelModule.' + index + '.key'"> <el-form-item class="param-box-row-key" :rules="[{required: true, message: $t('validate.required'), trigger: 'blur'},{ pattern: /[a-zA-Z_:][a-zA-Z0-9_:]*/, message: $t('validate.key') ,trigger: 'blur'}]" :prop="'labelModule.' + index + '.key'">
<el-input placeholder="key" size="mini" v-model="item.key"></el-input> <el-input placeholder="key" size="mini" v-model="item.key"></el-input>
</el-form-item> </el-form-item>
<span class="param-box-row-eq">=</span> <span class="param-box-row-eq">=</span>

View File

@@ -81,7 +81,7 @@
this.inputKeyErr.push(false); this.inputKeyErr.push(false);
}, },
validateInput:function(value,index){ validateInput:function(value,index){
if(!/^[a-zA-Z_:][a-zA-Z0-9_:]*/.test(value)){ if(!/[a-zA-Z_:][a-zA-Z0-9_:]*/.test(value)){
this.inputKeyErr.splice(index,1,true) this.inputKeyErr.splice(index,1,true)
}else{ }else{
this.inputKeyErr.splice(index,1,false) this.inputKeyErr.splice(index,1,false)