1、在父组件里引用自组件
<generate-report @closeAddReport="closeAddReport" ref="addreport"></generate-report>
2、在子组件中写对应的方法
methods: { childMethods() { alert(12) }, }
3、在父组件中调用
this.$refs.addreport.childMethods();
重点:这里有个重点,ref等号后面的值不能驼峰命名
1、在父组件里引用自组件
<generate-report @closeAddReport="closeAddReport" ref="addreport"></generate-report>
2、在子组件中写对应的方法
methods: { childMethods() { alert(12) }, }
3、在父组件中调用
this.$refs.addreport.childMethods();
重点:这里有个重点,ref等号后面的值不能驼峰命名