1,在父级
调动子级的方法,并传参
template
注入子级组件<childer ref="命名方法"/>
this.$refs.命名方法.子级方法名(data)
2,子级向父级传值
子:
script
this.$emit('getparimfo',data),getparimfo:命名,用于父级调用,data是传的值
父:
template
<childer @getparimfo="questchilder"/>
script
methods里直接调用questchilder(vla){
val输出就是子级的data 的值
}
1,父级
template
注入子级组件
<childer :childerValue="ageValue"/> childerValue:命名,ageValue:父级的一个值
2,子级
script
props:["childerValue"] 子级中就可以全局用这个字段 this.childerValue就可以