update Breadcrumb readme (#7947)

* update Breadcrumb readme

* update english
pull/7951/head
memoryza 7 years ago committed by 偏右
parent 712637907d
commit cf397a27f0

@ -31,10 +31,20 @@ The link of Breadcrumb item targets `#` by default, you can use `itemRender` to
```jsx
import { Link } from 'react-router';
const routes = [{
path: 'index',
 breadcrumbName: 'home'
}, {
path: 'first',
breadcrumbName: 'first'
}, {
path: 'second',
breadcrumbName: 'second'
}];
function itemRender(route, params, routes, paths) {
const last = routes.indexOf(route) === routes.length - 1;
return last ? <span>{route.breadcrumbName}</span> : <Link to={paths.join('/')}>{route.breadcrumbName}</Link>;
}
return <Breadcrumb itemRender={itemRender} />;
return <Breadcrumb itemRender={itemRender} routes={routes} />;
```

@ -31,10 +31,20 @@ title: Breadcrumb
```jsx
import { Link } from 'react-router';
const routes = [{
path: 'index',
breadcrumbName: '首页'
}, {
path: 'first',
breadcrumbName: '一级面包屑'
}, {
path: 'second',
breadcrumbName: '当前页面'
}];
function itemRender(route, params, routes, paths) {
const last = routes.indexOf(route) === routes.length - 1;
return last ? <span>{route.breadcrumbName}</span> : <Link to={paths.join('/')}>{route.breadcrumbName}</Link>;
}
return <Breadcrumb itemRender={itemRender} />;
return <Breadcrumb itemRender={itemRender} routes={routes}/>;
```

Loading…
Cancel
Save