<el-form-item label="是否激活" prop="activationId">
<el-select
v-model="formParams.activationId"
style="width: 140px"
clearable
placeholder="请选择"
>
<el-option
v-for="item in activationList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
<el-option
v-if="!activationList.some(list=> list.id === formParams.activationId)&&formParams.activationId!==''"
:label="formParams.activationName"
:value="formParams.activationId"
/>
</el-select>
</el-form-item>
export default {
data () {
return {
formParams:{
//回显被删除的id
activationId:1,
//回显被删除的name
activationName: '已激活'
},
activationList: [
//此处注释掉,假设第一条数据被删除
//{id: 1, name: '已激活'},
{id: 0, name: '未激活'}
]
}
}
}