if id=1, is selected and this item of id=1 is deleted from selectList, the value displayed in el-select
how do I not display a value when there is no matching value?
<el-select v-model="id" filterable :clearable="true">
<el-option
v-for="item in selectList"
:label="item.name"
:value="item.id"
:key="item.id">
</el-option>
</el-select>
data: {
selectList: [
{
name: "name1",
id: 1
},
{
name: "name2",
id: 2
}
]
}
the actual selectList is the dictionary data given by the background. When this.id = 1 is selected, the name1
should be shown in select, but the item {name: "name1", id: 1} is deleted in the background, so there is no match in select. The value shown in select is 1
, not name, and what I want is that if the match cannot be found, it will be empty!