Method of calling parent component by Alipay applet sub component


In fact, it is a very simple requirement. When using a custom component, sometimes the child component needs to call the method of the parent component to perform some operations, such as updating data
But the official document is not very clear, so you can record it for the next time

< button OnTap = "callfathercomponentmethod" > I am a subcomponent < / button >
        //Subcomponent calls are written in methods. Note that the function name must start with on

//Parent component.json
    'child component': '// components / your child component path'
//Parent component.axml
<child-compoent onCallFatherMethod="fatherMethod" />
//Again, the calling function must be on the head
//Parent component.js
console.log ('method of parent component called ')

OK is as simple as Vue’s custom component