vue props 传递function
发布于 5 年前 作者 ab8512 4907 次浏览 最后一次编辑是 5 年前 来自 问答
粉丝福利 : 关注VUE中文社区公众号,回复视频领取粉丝福利

parent.vue

<children @customfn="fn"></children>

children.vue

this.customfn() // 报错customfn 未定义

解决方法

parent.vue

<children :customfn="fn"></children>

children.vue

this.customfn() 
回到顶部