Browse Source

remove react-router dependency from breadcrumb

pull/29/head
afc163 10 years ago
parent
commit
925f811b45
  1. 2
      components/breadcrumb/demo/router.md
  2. 6
      components/breadcrumb/index.jsx

2
components/breadcrumb/demo/router.md

@ -35,7 +35,7 @@ var App = React.createClass({
<Link to="/">首页</Link> <Link to="/">首页</Link>
<Link to="/apps">应用列表</Link> <Link to="/apps">应用列表</Link>
</div> </div>
<Breadcrumb /> <Breadcrumb Router={Router} />
<RouteHandler /> <RouteHandler />
</div>); </div>);
} }

6
components/breadcrumb/index.jsx

@ -1,9 +1,6 @@
'use strict'; 'use strict';
import React from 'react'; import React from 'react';
import Router from 'react-router';
let Link = Router.Link;
let prefixCls = 'ant-breadcrumb'; let prefixCls = 'ant-breadcrumb';
@ -24,7 +21,8 @@ let Breadcrumb = React.createClass({
}, },
render() { render() {
var crumbs, routes, params; var crumbs, routes, params;
if (this.context.router) { if (this.context.router && this.props.Router) {
var Link = this.props.Router.Link;
routes = this.context.router.getCurrentRoutes(); routes = this.context.router.getCurrentRoutes();
params = this.context.router.getCurrentParams(); params = this.context.router.getCurrentParams();
crumbs = routes.map(function(route, i) { crumbs = routes.map(function(route, i) {

Loading…
Cancel
Save