mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
Fix breadcrumbName replace (#1797)
This commit is contained in:
parent
74ef0b7951
commit
4b05250a6b
@ -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>;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user