generated from Seekra/repository-template
feature(router): remove trailing slash(es)
This commit is contained in:
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user