From 1f4037f64cdf0579ba4de0bf7001b362d0e81dbf Mon Sep 17 00:00:00 2001 From: Jakob Scheid Date: Fri, 5 Jun 2026 13:45:31 +0200 Subject: [PATCH] feature(router): remove trailing slash(es) --- src/router/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/router/index.js b/src/router/index.js index 31622de..36fbbd7 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -65,6 +65,18 @@ const router = createRouter({ routes }); +// remove trailing slash(es) +router.beforeEach((route) => { + if (route.path !== '/' && route.path.endsWith('/')) { + return { + path: route.path.replace(/\/+$/, ''), + query: route.query, + hash: route.hash, + replace: true + }; + }; +}); + // set page title router.afterEach(to => { const title =