react 全局面包屑
renderBreadcrumb() { const {routes} = this.props; const items = routes.map((route, idx) => { let content = null; if (idx == 0) { content = <IndexLink to="/">{route.name}</IndexLink> } else { content = route.name; } return <Breadcrumb.Item key={idx}>{content}</Breadcrumb.Item>; }); return <Breadcrumb>{items}</Breadcrumb>; } {this.renderBreadcrumb()}