File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,8 @@ class Manager<TRoutesConfig extends TRouterConfig> {
8787
8888 if ( ! hasLeadingSlash && url . startsWith ( '/' ) ) {
8989 return url . substring ( 1 ) ;
90+ } else if ( hasLeadingSlash && ! url . startsWith ( '/' ) ) {
91+ return `/${ url } ` ;
9092 }
9193
9294 return url ;
@@ -116,10 +118,13 @@ class Manager<TRoutesConfig extends TRouterConfig> {
116118 { hasDomain = false } : IRouterUrlOptions = { } ,
117119 ) : string => {
118120 const path = this . getRouteUrl ( route as string , { isFullPath : true } ) ;
119- const url = generatePath ( path , params ) ;
120- const withPrefix = this . prefix ? `/${ this . prefix } ${ url } ` : url ;
121+ let url = generatePath ( path , params ) ;
121122
122- return hasDomain && this . domain ? `${ this . domain } ${ withPrefix } ` : withPrefix ;
123+ if ( this . prefix ) {
124+ url = `/${ this . prefix } ${ url === '/' ? '' : url } ` ;
125+ }
126+
127+ return hasDomain && this . domain ? `${ this . domain } ${ url } ` : url ;
123128 } ;
124129
125130 /**
You can’t perform that action at this time.
0 commit comments