browserHistory无法正常工作(ReactJS)

时间:2017-01-17 16:38:10

标签: javascript reactjs react-router

页面切换正常,但点击到另一个页面时URL不会改变,刷新页面后,我会重定向到主页

我的index.js

import React from 'react'
import {
    render
} from 'react-dom'
import {
    Provider as ReduxProvider
} from 'react-redux'
// import { Provider as IntlProvider } from './components/Intl'
import {
    Router,
    Route,
    IndexRoute,

    Link,
    Redirect,
    browserHistory
} from 'react-router'


import  App  from './containers/App'
import  Home  from './containers/Home/Home'
import  Course  from './containers/Course/Course'
import  Feedback  from './containers/Feedback/Feedback'
import  Revenue from './containers/Revenue/Revenue'
import  Income from './containers/Revenue/Income'
import  IncomeOver from './containers/Revenue/IncomeOver'


import {
    routerMiddleware
} from 'react-router-redux'

import {
    IntlProvider,
    addLocaleData
} from 'react-intl'
import en from 'react-intl/locale-data/en'
import zh from 'react-intl/locale-data/zh'
addLocaleData([...en, ...zh])




import {
    createStore,
    compose,
    applyMiddleware
} from 'redux'
import Immutable from 'immutable'
import {
    combineReducers
} from 'redux-immutable'
import thunk from 'redux-thunk'
render((
    <ReduxProvider >
        <IntlProvider locale={'en'}>
          <Router history={browserHistory}>
            <Route path="/" component={App}>
                <IndexRoute component={Home}/>
                <Route path="Course" component={Course}/>
                <Route path="Feedback" component={Feedback}/>
                <Route path="/Revenue" component={Revenue}>
                    <IndexRoute component={Income}/>
                    <Route path="Income" component={Income}/>
                    <Route path="IncomeOver" component={IncomeOver}/>

                </Route>
            </Route>

          </Router>
        </IntlProvider>
  </ReduxProvider>
), document.getElementById('mount'))

导航栏中的页面如下所示:

<li><Link to="/Revenue" activeClassName="activelink">REVENUE MANAGEMENT</Link></li>

为什么我没有获取URL,当我移动到另一个页面时?

0 个答案:

没有答案