情景:
el-select : @change方法需要传入(自定义)参数,还要接收select 选中的object对象
- 绑定item(object对象)时,需要在 el-select 标签 绑定value-key属性(值为:value绑定的item中的一个唯一标识)
- @change需要传入值时,写法如下。接收参数方法:
- (确定参数数量)按顺序接收:props1 , props2 , props3 ...
- (不缺定参数数量)用...操作符:
- 一次性接收全部参数:...reset(rest值为一个 [ ] 数组,其中每一个参数项亦为一个数组。结构:[ [ props1 ] , [ props2 ] , [ props3 ]... ] )。
- 接收部分参数,剩下的用...全部接收: ( 具体如下代码所示 )
- 函数参数为 changeSelect( props1,...rest ){ ... } :
- 值为:
- console.log( props1, rest ):props1 , [ [ props2 ] , [ props3 ]... ]
<el-select v-model="value" value-key="id" @change="(...arr) => select_ass