Element: el-select下拉框 获取值
1、给el-select绑定change事件:
<el-select v-model="currentRoleId" @change="getSelectValue">
<el-option label="请选择" :value="-1"></el-option>
<el-option
v-for="(item, i) in roles"
:key="i"
:label="item.rolename"
:value="item.id"
></el-option>
</el-select>
2、在methods中获取值:
getSelectValue(id) {
let obj = {};
obj = this.roles.find((item) => {
return item.id === id;
});
this.currentRoleName = obj.rolename;
},