在某些业务场景下,我们需要获取select的lable值和value值
获取label值代码如下:
<el-form-item label="测试" prop="goodsLocationId" >
<el-col :span="15">
<el-select v-model="scope.row.goodsLocationId" placeholder="货位地址" @change="changeLocationValue">
<el-option v-for="lo in locations" :label="lo.locationName" :value="lo.id" :key="lo.id"></el-option>
</el-select>
</el-col>
</el-form-item>
changeLocationValue(val){
//locations是v-for里面的也是datas里面的值
let obj = {};
obj = this.locations.find((item)=>{
return item.id === val;
});
let getName = ''
getName = obj.locationName;
console.log(getName)
}