vue select传多个值,传多个值的方法
el-select遍历方法,在el-select中写上@change,如@change=“pickRoleName”<el-select@change="pickRoleName"v-model="ToviewForm.deptId"placeholder="请选择"...
·
el-select遍历方法,在el-select中有个@change,如@change=“pickRoleName”
<el-select
@change="pickRoleName"
v-model="ToviewForm.deptId"
placeholder="请选择"
class="optionsone"
clearable
>
<el-option
v-for="item in optionsone" // optionsone数组
:key="item.id"
:label="item.deptName"
:value="item.id" //拿到optionsone中的id
></el-option>
</el-select>
js中调用@change="pickRoleName"方法
pickRoleName(e) {
this.optionsone.map((item, i) => {
if (item.id == e) {
this.ToviewForm.deptName = item.deptName; //传值
this.ToviewForm.deptId = item.id;//传值
}
});
},
更多推荐
已为社区贡献10条内容
所有评论(0)