学习antd的时候,在router.js中碰到这个函数,请问下这个方法中的history和app是从哪里解构来的对象
function RouterConfig({ history, app }) {
const routerData = getRouterData(app);
const UserLayout = routerData['/user'].component;
const BasicLayout = routerData['/'].component;
return (
<LocaleProvider locale={zhCN}>
<Router history={history}>
<Switch>
<AuthorizedRoute
path="/user"
render={props => <UserLayout {...props} />}
authority="guest"
redirectPath="/"
/>
<AuthorizedRoute
path="/"
render={props => <BasicLayout {...props} />}
authority={['admin', 'user']}
redirectPath="/user/login"
/>
</Switch>
</Router>
</LocaleProvider>
);
}
export default RouterConfig;
index.js中调用方式
// 4. Router
app.router(require('./router').default);
看看RouterConfig是在哪里调用的