1
我有以下航線配置:與重定向反應路由器
const route = {
path: 'services',
getComponent(nextState, callback) {
require.ensure([], (require) => {
callback(null, require('./components/services').default)
})
},
//getIndexRoute(partialNextState, callback) {
// require.ensure([], (require) => {
// callback(null, {component: require('./components/consulting').default})
// })
//},
childRoutes: [
{
path: 'consulting',
getComponent(nextState, callback) {
require.ensure([], (require) => {
callback(null, require('./components/consulting').default)
})
}
}
],
indexRedirect: {
//from: 'services',
to: 'consulting'
}
}
export default route
但是,當我去/services
我收到錯誤:
TypeError: element is null
當我使用的getIndexRoute
它工作得很好,但現在我希望重定向到/services/consulting
。考慮到我知道這不是組件,這個錯誤是什麼?