function getDefaultPath()

in src/components/common/Breadcrumbs/index.tsx [19:35]


function getDefaultPath(): Path[] {
  let currentPathName = useLocation().pathname.slice(1);
  if (currentPathName.endsWith("/")) {
    currentPathName = currentPathName.slice(0, -1);
  }
  currentPathName = currentPathName.replace("zh/", "");
  currentPathName = currentPathName[0].toUpperCase() + currentPathName.slice(1);
  const path: Path[] = currentPathName.split("/").map((item) => {
    return {
      name: item,
    };
  });
  for (let i = 0; i < path.length - 1; i++) {
    path[i].href = `/${path[i].name.toLocaleLowerCase()}`;
  }
  return path;
}