Browse Source

Add breadcrumbName

pull/180/head
afc163 9 years ago
parent
commit
53ce7a25c1
  1. 6
      components/breadcrumb/demo/router.md
  2. 2
      components/breadcrumb/index.jsx

6
components/breadcrumb/demo/router.md

@ -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>

2
components/breadcrumb/index.jsx

@ -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;

Loading…
Cancel
Save