mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-09 13:26:08 +10:00
fix: redirect /foo to /foo/ during dev (close #183)
This commit is contained in:
@@ -63,6 +63,17 @@ export function createApp () {
|
||||
}
|
||||
})
|
||||
|
||||
// redirect /foo to /foo/
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (!/(\/|\.html)$/.test(to.path)) {
|
||||
next(Object.assign({}, to, {
|
||||
path: to.path + '/'
|
||||
}))
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
const options = {}
|
||||
|
||||
enhanceApp({ Vue, options, router })
|
||||
|
||||
Reference in New Issue
Block a user