Add breadcrumbName

This commit is contained in:
afc163 2015-08-21 16:41:39 +08:00
parent 71f4d3f95f
commit 53ce7a25c1
2 changed files with 4 additions and 4 deletions

View File

@ -44,9 +44,9 @@ var Home = React.createClass({
React.render((
<Router history={history}>
<Route name="首页" path="/" component={Home} ignoreScrollBehavior>
<Route name="应用列表" path="apps" component={Apps}>
<Route name="应用:id" path=":id" />
<Route name="home" breadcrumbName="首页" path="/" component={Home} ignoreScrollBehavior>
<Route name="apps" breadcrumbName="应用列表" path="apps" component={Apps}>
<Route name="app" breadcrumbName="应用:id" path=":id" />
</Route>
</Route>
</Router>

View File

@ -25,7 +25,7 @@ let Breadcrumb = React.createClass({
routes = this.context.router.state.branch;
params = this.context.router.state.params;
crumbs = routes.map(function(route, i) {
var name = route.name.replace(/\:(.*)/g, function(replacement, key) {
var name = route.breadcrumbName.replace(/\:(.*)/g, function(replacement, key) {
return params[key] || replacement;
});
var link;