dvajs/dva-knowledgemap

dva/router不返回children和routes

Closed this issue · 0 comments

使用dva 2.0.1,router配置如下

import React from 'react';
import { Router, Switch, Route, IndexRoute } from 'dva/router';
import IndexPage from './routes/IndexPage'
import CountPage from './routes/CountPage'

function RouterConfig({ history }) {
  return (
    <Router history={history}>
      <Route path="/" component={IndexPage}>
        {/*<Switch>*/}
          <Route path="/count" component={CountPage}/>
          <Route path="/statements" component={CountPage}/>
        {/*</Switch>*/}
      </Route>
    </Router>
  );
}

export default RouterConfig;

在IndexPage中输出的props里面没有children和routes

import React from 'react';
import { connect } from 'dva';
import styles from './IndexPage.css';
import { Layout } from 'antd'
import Header from '../components/Header'

const { Sider, Content, Footer } = Layout;

const IndexPage = (props) => {
  const { children, routes } = props;
  console.log(props);
  return (
    <Layout>
      <Header routes={routes}>header</Header>
      <Layout>
        <Sider>sider</Sider>
        <Content>{children || "No content"}</Content>
      </Layout>
      <Footer>2017</Footer>
    </Layout>
  );
}

default