remove react-router dependency from breadcrumb

This commit is contained in:
afc163 2015-07-02 21:58:04 +08:00
parent 46aee94b06
commit 925f811b45
2 changed files with 3 additions and 5 deletions

View File

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

View File

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