Fix breadcrumbName replace (#1797)

This commit is contained in:
afc163 2016-06-11 17:05:19 +08:00
parent 74ef0b7951
commit 4b05250a6b

View File

@ -5,8 +5,10 @@ const defaultNameRender = (breadcrumbName, route, params) => {
if (!breadcrumbName) { if (!breadcrumbName) {
return null; return null;
} }
const paramsKeys = Object.keys(params).join('|');
const name = breadcrumbName.replace( const name = breadcrumbName.replace(
/:(.*)/g, (replacement, key) => params[key] || replacement new RegExp(`:(${paramsKeys})`, 'g'),
(replacement, key) => params[key] || replacement
); );
return <span>{name}</span>; return <span>{name}</span>;
}; };