Optimize code
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user