Commit d82b6972 authored by 左玲玲's avatar 左玲玲 😬

1357

parent c53507cf
......@@ -152,11 +152,16 @@ export const layout = ({ initialState, setInitialState }) => {
noFound: <div>noFound</div>,
// 增加一个 loading 的状态
childrenRender: (children, props) => {
// if (initialState?.loading) return <PageLoading />;
let home, items = initialState?.newMenu?.userHavePermList ?? [];
if (history.location.pathname != "/welcome" && history.location.pathname != "/") {
home = history.location.pathname
} else {
home = items?.length > 0 ? items[0].path.indexOf("/") > -1 ? items[0].path : items[0]?.routes?.length > 0 ? items[0]?.routes[0]?.path : "" : "";
}
return (
<>
{initialState?.currentUser && location.pathname !== loginPath ? (
<TagView home="/welcome">{children}</TagView>
<TagView home={home}>{children}</TagView>
) : (
children
)}
......
......@@ -34,7 +34,7 @@ const TagView = ({ home }) => {
treeForeach(menuData, (node) => {
allarr.push(node);
});
const firstTag = allarr.filter((el) => el.path === location?.hash?.replace('#', ''))[0];
const firstTag = allarr.filter((el) => el.path === home)[0];
if (firstTag) {
const title = firstTag.name;
const path = firstTag.path;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment