From 99a44e9b5eacd00daf9be63f9e61e062011d3345 Mon Sep 17 00:00:00 2001 From: "fanzheng.fz" Date: Wed, 23 Mar 2016 00:26:22 +0800 Subject: [PATCH] always concat paths wether there's a breadcrumbName or not --- components/breadcrumb/index.jsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/breadcrumb/index.jsx b/components/breadcrumb/index.jsx index f9e0f8bd23..593d8f3769 100644 --- a/components/breadcrumb/index.jsx +++ b/components/breadcrumb/index.jsx @@ -52,14 +52,6 @@ const Breadcrumb = React.createClass({ if (routes && routes.length > 0) { const paths = []; crumbs = routes.map((route, i) => { - if (!route.breadcrumbName) { - return null; - } - const name = route.breadcrumbName.replace(/\:(.*)/g, (replacement, key) => { - return params[key] || replacement; - }); - - let link; let path = route.path.replace(/^\//, ''); Object.keys(params).forEach(key => { path = path.replace(`:${key}`, params[key]); @@ -68,6 +60,14 @@ const Breadcrumb = React.createClass({ paths.push(path); } + if (!route.breadcrumbName) { + return null; + } + const name = route.breadcrumbName.replace(/\:(.*)/g, (replacement, key) => { + return params[key] || replacement; + }); + + let link; if (i === routes.length - 1) { link = {name}; } else {