慕后森
routes.map(({path, models, component, ...dynamics},key)) => ( if (model) { dynamics.models = () => models(); } dynamics.component = () => component(); <Router key={key} exact path={path} component={dynamic({ app, ...dynamics })})你要把model引入。if (model) { dynamics.models = () => models();}dynamics.component = () => component();//相当于:const UserPageComponent = dynamic({ app, models: () => [ import('./models/users'), ], component: () => import('./routes/UserPage'),});//你需要把model引入你的组件。。。。routes.map(({path, models, component, ...dynamics},key)) => { if (models) { dynamics.models = () => models(); } dynamics.component = () => component(); return ( <Router key={key} exact path={path} component={dynamic({ app, ...dynamics })} )}见链接