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 =