Skip to content

Function: getParentPaths() ​

ts
function getParentPaths(pathname): string[];

Generates all parent path segments for a pathname, commonly used for menu openKeys. 根据 pathname 生成所有父级路径数组。

Parameters ​

ParameterType
pathnamestring

Returns ​

string[]

Example ​

ts
getParentPaths('/system/user/list')
// => ['/system', '/system/user']

Since ​

1.3.0

Released under the MIT License.