1. 程式人生 > >el-select 根據value查詢其對應的label值

el-select 根據value查詢其對應的label值

tle -s -a lac find urn sub ring clas

<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){

  let obj = {};

  obj = this.locations.find((item)=>{

    return item.id === val;

  });

  this.goodsLocationId.goodsLocationName = obj.locationName;

},

el-select 根據value查詢其對應的label值