1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 import { Form } from "react-bootstrap"; const Editor0 = (props) => { if (props.init) { props.init({ getContent:()=> getContent() }) } } const App = ()=> { return ( <> <Editor0 init={( a) => console.log('init ref',a)} /> </> ) } 这样 通过回调 就能获得子组