Reinit project
This commit is contained in:
40
src/pages/home/_layout.tsx
Normal file
40
src/pages/home/_layout.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Routes:
|
||||
* - ./src/pages/routes
|
||||
*/
|
||||
import React from 'react';
|
||||
import { connect, DispatchProp } from 'dva';
|
||||
import { RouterTypes, Redirect } from 'umi';
|
||||
import Tab from '@/components/Tab';
|
||||
|
||||
import styles from './style.less';
|
||||
import { HomeModelState } from './model';
|
||||
|
||||
const HomePage: React.FC<RouterTypes & DispatchProp & HomeModelState> = ({
|
||||
dispatch,
|
||||
tabItems,
|
||||
selectedTab,
|
||||
location: { pathname },
|
||||
children,
|
||||
}) => {
|
||||
if (pathname === '/home') return <Redirect to="/home/home" />
|
||||
|
||||
return (
|
||||
<div className={styles.home}>
|
||||
<section className={styles.page}>
|
||||
{children}
|
||||
</section>
|
||||
<footer className={styles.tab}>
|
||||
<Tab
|
||||
items={tabItems}
|
||||
selectedKey={selectedTab}
|
||||
onChange={payload => dispatch({ type: 'home/changeTab', payload })}
|
||||
/>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(
|
||||
({ home }: any) => ({ ...home }),
|
||||
)(HomePage);
|
||||
Reference in New Issue
Block a user