<div v-for="(item, index) in dataForm.dynamicItem" :key="index">
<el-row>
<el-col>
<el-button type="text" style="width:85px;" :disabled="!isModify" @click="deleteItem(item, index)">删除特性</el-button>
<el-row>
<el-col span="8">
<el-form-item label="特性" :prop="'dynamicItem.' + index + 'featureNum'">
<el-input size="mini" :disabled="!isModify" v-model="dataForm.featureNum" placeholder="特征" clearable style="width:140px;">
</el-input>
</el-form-item>
</el-col>
<el-col span="8">
<el-form-item label="特性内容" :prop="'dynamicItem.' + index + 'featureContent'">
<el-input size="mini" type="textarea" :disabled="!isModify"
autosize v-model="dataForm.featureContent" placeholder="特征内容" clearable >
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-col>
</el-row>
</div>
- <el-button type="text" style="width:85px;" :disabled="!isModify" @click="addItem">添加特性</el-button>
- dynamicItem: []
addItem () {
this.dataForm.dynamicItem.push({
featureContent: '',
featureNum: ''
- })
deleteItem (item, index) {
- this.dataForm.dynamicItem.splice(index,1)
- 上面代码写的可以实现在弹出框上实现添加删除,保持完了,一刷新在打开就没有了。
- 之前是特性是死的不能动态添加的,改的时候加了个表,现在数据保存不了。请求自己写了好多还是不行。