File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -299,9 +299,12 @@ export const Link = forwardRef((props, ref) => {
299299 }
300300 } ) ;
301301
302+ const targetPathAbsolute =
303+ targetPath [ 0 ] === "~" ? targetPath . slice ( 1 ) : router . base + targetPath ;
304+
302305 // handle nested routers and absolute paths
303306 const href = router . hrefs (
304- targetPath [ 0 ] === "~" ? targetPath . slice ( 1 ) : router . base + targetPath ,
307+ targetPathAbsolute ,
305308 router // pass router as a second argument for convinience
306309 ) ;
307310
@@ -312,7 +315,9 @@ export const Link = forwardRef((props, ref) => {
312315 onClick,
313316 href,
314317 // `className` can be a function to apply the class if this link is active
315- className : cls ?. call ? cls ( currentPath === targetPath ) : cls ,
318+ className : cls ?. call
319+ ? cls ( router . base + currentPath === targetPathAbsolute )
320+ : cls ,
316321 children,
317322 ref,
318323 } ) ;
You can’t perform that action at this time.
0 commit comments