Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

子路由如何配置呢 #20

Open
feibi opened this issue May 10, 2017 · 1 comment
Open

子路由如何配置呢 #20

feibi opened this issue May 10, 2017 · 1 comment

Comments

@feibi
Copy link

feibi commented May 10, 2017

const routes = [
    {
      path: '/',
      component: App,
      breadcrumbName: '首页',
      getIndexRoute(nextState, cb) {
        require.ensure([], require => {
          cb(null, {component: require('./routes/indexPage')})
        }, 'index')
      },
      childRoutes: [
        {
          path: '/user',
          breadcrumbName: '用户列表',
          getComponents(nextState, cb) {
            require.ensure([], require => {
              registerModel(app, require('./models/user'))
              cb(null, require('./routes/user/list/'))
            }, 'user')
          },
          childRoutes:[
            {
              path: ':id',
              breadcrumbName: '用户:id',
              getComponents(nextState, cb) {
                require.ensure([], require => {
                  //registerModel(app, require('./models/user'))
                  cb(null, require('./routes/user/detail/'))
                }, 'user')
              },
            },
          ]
        },  {
          path: '*',
          breadcrumbName: 'error',
          getComponent(nextState, cb) {
            require.ensure([], require => {
              cb(null, require('./routes/error/'))
            }, 'error')
          }
        }
      ]
    }
  ];

这时候 :id这个路由的component 渲染不出来,依然是 list

@gyxing
Copy link

gyxing commented Aug 27, 2017

同样的疑问,楼主解决没?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants