我的路由器如下所示,
[
{
path: '/',
component: App,
childRoutes: [
{
path: 'dashboard',
getComponent: function(location, cb) {
require.ensure([], function(require) {
cb(null, require('../plugins/dashboard/index'))
})
},
childRoutes: [
{
path: '/:id',
getComponent: function(location, cb) {
require.ensure([], function(require) {
cb(null, require('../plugins/dashboard/saved_dashboard'))
})
}
}
]
},
{
path: 'profile',
getComponent: function(location, cb) {
require.ensure([], function(require) {
cb(null, require('../plugins/profile/index'))
})
}
}
]
}
];
我的菜单组件示例代码看起来像
<ul id='menu'>
<li>
<Link to='dashboard'>dashboard</Link>
</li>
<li>
<Link to='dashboard/mydashboard'>my dashboard</Link>
</li>
<li>
<Link to='profile'>profile</Link>
</li>
</ul>
问题是当我单击“我的仪表板”时,它会路由到
localhost/dashboard/mydashboard
如果我再次单击“我的仪表板”,它将从这里路由到
localhost/dashboard/mydashboard/dashboard/mydashboard
并继续前进。
如何解决这个问题?我在哪里做错了?或者我必须在配置中做更多的事情?