@flatbiz/pro-layout 5.2.12 → 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 +10 -3
- 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 | 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,12 +863,19 @@ 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
|
-
|
|
870
|
+
var breadTitle = typeof ctx.breadTitle === 'function' ? ctx.breadTitle(location.pathname) : ctx.breadTitle;
|
|
871
|
+
var titleItems = Array.isArray(breadTitle) ? breadTitle.map(function (title) {
|
|
872
|
+
return {
|
|
873
|
+
title: title
|
|
874
|
+
};
|
|
875
|
+
}) : breadTitle ? [{
|
|
876
|
+
title: breadTitle
|
|
871
877
|
}] : [];
|
|
878
|
+
var items = _toConsumableArray(titleItems);
|
|
872
879
|
var routes = breadRoutes.sort(function (a, b) {
|
|
873
880
|
return a.path.length - b.path.length;
|
|
874
881
|
});
|
|
@@ -897,7 +904,7 @@ var Bread = function Bread(props) {
|
|
|
897
904
|
}
|
|
898
905
|
});
|
|
899
906
|
return items;
|
|
900
|
-
}, [breadRoutes, ctx.breadTitle]);
|
|
907
|
+
}, [breadRoutes, ctx.breadTitle, location.pathname]);
|
|
901
908
|
if (!breadRoutes.length) {
|
|
902
909
|
return null;
|
|
903
910
|
}
|