打开路径/,不会跳转到/hot/now路由,indexRedirect的设置没起作用
import React, { Component } from 'react';
import ReactDom from 'react-dom';
import { Router, Route, IndexRoute, IndexRedirect, hashHistory } from 'react-router';
import { Provider } from 'react-redux';
import { syncHistoryWithStore } from 'react-router-redux';
import store from './redux/store';
const history = syncHistoryWithStore(hashHistory, store);
class App extends Component {
render() {
return (
<div>
{this.props.default}
</div>
);
}
}
ReactDom.render(
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App}>
<IndexRedirect to="/hot/now" />
<Route path="p/:id"
getComponent={(location, callback) => {
require.ensure([], require => {
callback(null, require('./widget/article/article'))
}, 'article')
} } />
<Route path=":type/:cate"
getComponent={(location, callback) => {
require.ensure([], require => {
callback(null, require('./widget/trend/trend'))
}, 'trend')
} } />
</Route>
</Router>
</Provider>,
document.getElementById('app')
);
是不是前面的尖括号没写对,写成了中文的