From 4b05250a6becfdc2d7e488bc596ed3b2ea915d14 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 11 Jun 2016 17:05:19 +0800 Subject: [PATCH] Fix breadcrumbName replace (#1797) --- components/breadcrumb/Breadcrumb.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/breadcrumb/Breadcrumb.jsx b/components/breadcrumb/Breadcrumb.jsx index 662d1ddf82..a17fcbeab6 100644 --- a/components/breadcrumb/Breadcrumb.jsx +++ b/components/breadcrumb/Breadcrumb.jsx @@ -5,8 +5,10 @@ const defaultNameRender = (breadcrumbName, route, params) => { if (!breadcrumbName) { return null; } + const paramsKeys = Object.keys(params).join('|'); const name = breadcrumbName.replace( - /:(.*)/g, (replacement, key) => params[key] || replacement + new RegExp(`:(${paramsKeys})`, 'g'), + (replacement, key) => params[key] || replacement ); return {name}; };