子组件:
props {
onSuccess: {
type: Function,
default: noop
}
}
methods: {
handleSuccess(res, rawFile) {
this.onSuccess(res, file, this.uploadFiles);
}
}
父组件使用:
<el-upload
class="avatar-uploader upload"
:action="cloudUrl"
:on-success="handleUrl">
methods: {
handleUrl(response, file, fileList) {
}
}
假设不改变子组件的,父组件的增加额外参数:
methods: {
handleUrl(response, file, fileList, extra) {
}
}
:on-success="handleUrl"应该怎么改传参?
如果子组件用emit的话,父组件可以用...arguments代表旧的参数,用props传函数再用...arguments不行,$event也不行。求教
评论邀请回答
函数式编程
萧十郎
相关分类