From: MonsterPi <43134418+MonsterPi13@users.noreply.github.com> Date: Fri, 15 Dec 2023 07:11:09 +0000 (+0800) Subject: refactor: simplify location parsing (#1691) X-Git-Tag: v4.3.0~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b298d56db5e81fc1b94c639f4b34349fdecddda2;p=thirdparty%2Fvuejs%2Frouter.git refactor: simplify location parsing (#1691) * chore: maybe it's unnecessary to add this expression * style: format code --- diff --git a/packages/router/src/location.ts b/packages/router/src/location.ts index ef85d359..1f29cfb6 100644 --- a/packages/router/src/location.ts +++ b/packages/router/src/location.ts @@ -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('/') ) }