element el-select 下拉选中获取整个对象(多个传参)

element中的el-select如何获取选中的整个对象

注意下面代码几项

  • value-key=“id”
  • :key=“item.id”
  • :value=“item”
    <el-select v-model="selectionArr" value-key="id" multiple placeholder="请选择" style="width: 100%" @change="selectChange($event)">
      <el-option
        v-for="item in options"
        :key="item.id"
        :label="item.name"
        :value="item">
      </el-option>
    </el-select>
    
    
    selectChange(event) {
        // event 就是已选中的对象数组 , 这里是多选multiple,所以是数组
        // 与 selectionArr 是相同的
    }


    原文链接:https://blog.csdn.net/aa390481978/article/details/111317356

 

已解决:

 

  <el-table-column label="库位">
    <template slot-scope="scope">
      <el-form-item :prop="'selectData.' + scope.$index + '.sto_bin_number'" :rules="infoForm.rules.sto_bin_number">
          <el-select
            v-model="scope.row.sto_bin_number"
              @change="changeId($event)"
              value-key="sto_bin_id"
placeholder="请选择"> <el-option v-for="item in storageBinList"
:key="item.sto_bin_id"
:label="item.sto_bin_number"
:value="item">
</el-option> </el-select>
</el-form-item> </template> </el-table-column>

    changeId(event) {
    console.log(event);
      let stoBinId = event.sto_bin_id;
      let stoBinNumber = event.sto_bin_number;

 

posted @ 2021-09-01 10:15  ℳℓ马温柔  阅读(3728)  评论(0编辑  收藏  举报