原来的代码是这样的:handleAvatarSuccess会回调两个参数,这个时候如果直接在里面添加形参接不到

<el-upload :on-success="handleAvatarSuccess">
</el-upload>
handleAvatarSuccess(res) { //自带的回调参数res跟file
	console.log('res', res)
<el-upload :on-success="($event) =>{handleAvatarSuccess($event,1)}">
</el-upload>
handleAvatarSuccess($event, flag){ //通过flag接收传过来的1
	console.log('res', $event)

如果有多个回调参数,则用"..."接收

<el-upload :on-success="(...event) =>{handleAvatarSuccess(event, 1)}">
</el-upload>
handleAvatarSuccess(param, flag){ //通过flag接收传过来的1
    let res = param[0]
	let file = param[1]
	console.log('res', res)

十分感谢原博主,原博客的地址为:

  • vue如何给自带默认回调参数的函数添加自定义参数:$event
  • vue中函数有回调参数,添加参数时如何调取默认回调参数
  •