vue+element select获取对象

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

},