Skip to content

Function: matchRoutePath() ​

ts
function matchRoutePath(routePath, pathname): boolean;

Checks whether a pathname matches a route path (supports :param dynamic segments). 判断当前 pathname 是否匹配给定的 routePath(支持 :param 动态参数)。

Parameters ​

ParameterTypeDescription
routePathstringRoute path / 路由路径
pathnamestringCurrent pathname / 当前 pathname

Returns ​

boolean

true if matched / 匹配时返回 true

Since ​

1.3.0

Released under the MIT License.