@flatbiz/pro-layout 5.2.13 → 5.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -308,8 +308,8 @@ export type BootstrapOptions = {
|
|
|
308
308
|
* ```
|
|
309
309
|
*/
|
|
310
310
|
accountOperateMenuItems?: MenuProps["items"];
|
|
311
|
-
/**
|
|
312
|
-
breadTitle?: string | string[] | ReactElement;
|
|
311
|
+
/** 面包屑起始标题;函数形式时 path 为当前访问地址 */
|
|
312
|
+
breadTitle?: string | string[] | ReactElement | ((path: string) => string[]);
|
|
313
313
|
/** 面包屑位置功能扩展 */
|
|
314
314
|
breadExtendRender?: ReactElement;
|
|
315
315
|
/** 隐藏默认设置的面包屑,默认值false */
|
package/dist/index.js
CHANGED
|
@@ -863,15 +863,17 @@ var Bread = function Bread(props) {
|
|
|
863
863
|
var _ctx$breadcrumbProps;
|
|
864
864
|
var ctx = bootstrapCtx();
|
|
865
865
|
var iframeApi = useIframe();
|
|
866
|
+
var location = useLocation();
|
|
866
867
|
var globalData = getGlobalData();
|
|
867
868
|
var breadRoutes = useBread(ctx.breads || {}, globalData.routeBaseName);
|
|
868
869
|
var breadcrumbItems = useMemo(function () {
|
|
869
|
-
var
|
|
870
|
+
var breadTitle = typeof ctx.breadTitle === 'function' ? ctx.breadTitle(location.pathname) : ctx.breadTitle;
|
|
871
|
+
var titleItems = Array.isArray(breadTitle) ? breadTitle.map(function (title) {
|
|
870
872
|
return {
|
|
871
873
|
title: title
|
|
872
874
|
};
|
|
873
|
-
}) :
|
|
874
|
-
title:
|
|
875
|
+
}) : breadTitle ? [{
|
|
876
|
+
title: breadTitle
|
|
875
877
|
}] : [];
|
|
876
878
|
var items = _toConsumableArray(titleItems);
|
|
877
879
|
var routes = breadRoutes.sort(function (a, b) {
|
|
@@ -902,7 +904,7 @@ var Bread = function Bread(props) {
|
|
|
902
904
|
}
|
|
903
905
|
});
|
|
904
906
|
return items;
|
|
905
|
-
}, [breadRoutes, ctx.breadTitle]);
|
|
907
|
+
}, [breadRoutes, ctx.breadTitle, location.pathname]);
|
|
906
908
|
if (!breadRoutes.length) {
|
|
907
909
|
return null;
|
|
908
910
|
}
|