<el-select v-model="value8" filterable placeholder="请选择" value-key="id" @change="currentSel">
    <el-option v-for="item in options" :key="item.id" :label="item.label" :value="item"></el-option>
 </el-select>

需要注意的是:value-key="id"这里的 id 需要和 el-option 的 key 绑定的属性一致,而且 value 绑定整个整个 item 对象

currentSel(selVal) {
this.code = selVal.code;
this.name = selVal.label;
console.log("选择的name为:" + this.name, "选择的code为:" + this.code);
console.log(selVal);
},

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2021-08-05
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案