Optimize code

This commit is contained in:
2024-01-08 13:43:47 +08:00
parent d526d913b9
commit 88c66bd7a7
12 changed files with 68 additions and 70 deletions

View File

@@ -7,10 +7,9 @@ export const getRedirectUrl = (path: string, redirectUrl: string): string => {
export const getFullTitle = (data: _DataNode, preTitle?: string) => {
data.fullTitle = `${preTitle ? `${preTitle}-` : ''}${data.title as string}`
data.children &&
data.children.forEach((value) => {
getFullTitle(value, data.fullTitle)
})
data.children?.forEach((value) => {
getFullTitle(value, data.fullTitle)
})
return data
}