码迷,mamicode.com
首页 > 其他好文 > 详细

子组件通过this.$emit方式向父组件传递参数的问题

时间:2019-11-03 01:10:28      阅读:640      评论:0      收藏:0      [点我收藏+]

标签:自定义   接受   http   iss   issue   body   argument   vue   pre   

  子组件通过this.$emit向父组件传递参数,并且又需要在父组件中使用自定义参数的时候,对应下面两种情况,来接受参数

子组件传出单个参数时:

// 子组件
this.$emit(‘test‘,this.param)
// 父组件
@test=‘test($event,userDefined)‘ 

子组件传出多个参数时:

// 子组件
this.$emit(‘test‘,this.param1,this.param2, this.param3)
// 父组件 arguments 是以数组的形式传入
@test=‘test(arguments,userDefined)‘

 

参考文献

https://github.com/vuejs/vue/...

原文地址:https://segmentfault.com/a/1190000016726750

子组件通过this.$emit方式向父组件传递参数的问题

标签:自定义   接受   http   iss   issue   body   argument   vue   pre   

原文地址:https://www.cnblogs.com/david-lcw/p/11784811.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!