el-select获取label value值 id name

<template>
<el-select
v-model="addForm.id"
clearable
@change="queryName"
>
<el-option
v-for="item in anchorOption"
:key="item .id"
:label="item .name"
:value="item .id"/>
</el-select>
</template>
<script>

export default {
data() {
return {
anchorOption:[],

addForm: {}
},
}
methods:{
queryName(e){
let arr= this.anchorOption.filter((item)=>{
return item.id=== e
});
this.addForm.name= arr[0].name
},

}
</script>

posted @ 2021-08-28 11:02  Smile浅笑  阅读(1486)  评论(0编辑  收藏  举报