fix Breadcrumb.tsx

getPath() 参数赋默认值
This commit is contained in:
haianweifeng 2019-05-30 17:28:19 +08:00 committed by GitHub
parent 3122f3b86b
commit 1fac84b222
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,8 +71,8 @@ export default class Breadcrumb extends React.Component<BreadcrumbProps, any> {
);
}
getPath = (path, params) => {
path = (path || '').replace(/^\//, '');
getPath = (path = '', params = {}) => {
path = path.replace(/^\//, '');
Object.keys(params).forEach(key => {
path = path.replace(`:${key}`, params[key]);
});