fix: redirect /foo to /foo/ during dev (close #183)

This commit is contained in:
Evan You
2018-04-20 17:07:40 -04:00
parent 748fa7f7ee
commit 99bc0aa520
+11
View File
@@ -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 })