]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor: simplify location parsing (#1691)
authorMonsterPi <43134418+MonsterPi13@users.noreply.github.com>
Fri, 15 Dec 2023 07:11:09 +0000 (15:11 +0800)
committerGitHub <noreply@github.com>
Fri, 15 Dec 2023 07:11:09 +0000 (08:11 +0100)
* chore: maybe it's unnecessary to add this expression

* style: format code

packages/router/src/location.ts

index ef85d359b13a0b846c6ca63ffa4c9072fa0ddd0d..1f29cfb634251ea7bbd8f5df529d765119a6a445 100644 (file)
@@ -244,9 +244,6 @@ export function resolveRelativePath(to: string, from: string): string {
   return (
     fromSegments.slice(0, position).join('/') +
     '/' +
-    toSegments
-      // ensure we use at least the last element in the toSegments
-      .slice(toPosition - (toPosition === toSegments.length ? 1 : 0))
-      .join('/')
+    toSegments.slice(toPosition).join('/')
   )
 }