<template> <div> <buildProject ref="buildProject"></buildProject> </div> </template> <script> import buildProject from "./build-project/index" export default { components: { buildProject }, methods: { submit() { this.$refs.buildProject.test(); } } }; </script>
父组件调用子组件方式:this.$refs.buildProject.test();
1、buildProject是子组件的名字ref属性;2、test是子组件的方法
(父组件获取多个子组件的表单等数据可以统一操作)