index.js 911 B

123456789101112131415161718192021222324252627282930313233
  1. import React, { Component } from 'react';
  2. import { Redirect, Route, Switch } from 'dva/router';
  3. import { connect } from 'dva';
  4. import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
  5. import { getRoutes } from '../../../utils/utils';
  6. @connect()
  7. export default class Recommend extends Component {
  8. render() {
  9. const { match, routerData } = this.props;
  10. const routes = getRoutes(match.path, routerData);
  11. return (
  12. <PageHeaderLayout>
  13. <Switch>
  14. {
  15. routes.map(item =>
  16. (
  17. <Route
  18. key={item.key}
  19. path={item.path}
  20. component={item.component}
  21. exact={item.exact}
  22. />
  23. )
  24. )
  25. }
  26. <Redirect exact from="/frontend/recommend" to="/frontend/recommend/list" />
  27. </Switch>
  28. </PageHeaderLayout>
  29. );
  30. }
  31. }