前端框架:ant design vue @1.6.2
在a-form中想增加一个功能,有一个输入框,输入框后面是加号按钮,点击加号按钮后会再出现一个输入框,第一个输入框后面的加号变成减号,第二个输入框后面是加号,一次类推,输入框中的值会绑定checkForm.eol_defect
现在按照下面的代码,页面不显示输入框(如下图所示)
。。。。前面的省略
<a-row v-show="checkForm.preorderPoint && checkForm.preorderPoint.includes('EOL')">
<a-col :span="8"></a-col>
<a-col :span="10">
<p style="font-size: 18px;font-weight: bold;"> 前序监控EOL语言描述</p>
</a-col>
</a-row>
<a-form-model-item v-show="checkForm.preorderPoint && checkForm.preorderPoint.includes('EOL')" label="EOL语言描述">
<div v-for="(item, index) in checkForm.eol_defect" :key="index">
<a-input v-model="checkForm.eol_defect[index]" style="width: 100%;"></a-input>
<a-button v-if="index === checkForm.eol_defect.length - 1" @click="addInput">+</a-button>
<a-button v-else @click="removeInput(index)">-</a-button>
</div>
</a-form-model-item>
。。。。后面的省略
export default {
data() {
return {
checkForm: {
eol_defect:[],
}
}
},
methods: {
addInput() {
this.checkForm.eol_defect.push('');
},
removeInput(index) {
this.checkForm.eol_defect.splice(index, 1);
},
}
};
。。。。后面的省略