父组件把方法传入子组件中,在子组件中直接调用这个方法
通过绑定属性的方法传方法名给子组件,组件通过props接收,子组件中通过this直接调用父组件中的方法
<child :parentMethod= “parentMethod”></child>
prop:{
parentMethod:{
type : Function,
default: null
}
}
父组件把方法传入子组件中,在子组件中直接调用这个方法
通过绑定属性的方法传方法名给子组件,组件通过props接收,子组件中通过this直接调用父组件中的方法
<child :parentMethod= “parentMethod”></child>
prop:{
parentMethod:{
type : Function,
default: null
}
}