我正在使用React-Router v.2.4.0并尝试在用户导航到路径#/?_k=mftgqo/profile
时呈现嵌套路由。但是,我在浏览器中收到以下错误消息:
Warning: [react-router] Location "//profile" did not match any routes
App.js文件:
var React = require('react');
var ReactDOM = require('react-dom');
var Router = require('react-router').Router;
var hashHistory = require('react-router').hashHistory;
var routes = require('./routes');
ReactDOM.render(
<Router history={hashHistory}>{routes}</Router>,
document.getElementById('app')
)
routes.js file
var React = require('react');
var Main = require('./Main');
var Home = require('./Home');
var Profile = require('./Profile');
var Router = require('react-router');
var Route = Router.Route;
var IndexRoute = Router.IndexRoute;
module.exports = (
<Route path='/' component={Main}>
<Route path='profile' component={Profile} />
<IndexRoute component={Home} />
</Route>
);
索引路由正确呈现但不是配置文件路由。有什么想法吗?