删除循环中选中的id
del(num, item) {
this.diseaseName.splice(num, 1);
},
<el-col>
<el-form-item label="相关疾病" prop="disease">
<el-select
v-model="formDatanew.disease"
value-key="id"
placeholder="请选择相关疾病"
@change="currentSel"
>
<el-option
v-for="item in diseaseList"
:key="item.id"
:label="item.name"
:value="item"
></el-option>
</el-select>
<span
class="diseaseStyle"
v-for="(item, index) in diseaseName"
:key="index"
@click="del(index,item)"
>{{item}}X</span>
</el-form-item>
</el-col>
不求大富大贵,但求一生平凡