Skip to content

Commit 99bc0aa

Browse files
committed
fix: redirect /foo to /foo/ during dev (close #183)
1 parent 748fa7f commit 99bc0aa

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/app/app.js

+11
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ export function createApp () {
6363
}
6464
})
6565

66+
// redirect /foo to /foo/
67+
router.beforeEach((to, from, next) => {
68+
if (!/(\/|\.html)$/.test(to.path)) {
69+
next(Object.assign({}, to, {
70+
path: to.path + '/'
71+
}))
72+
} else {
73+
next()
74+
}
75+
})
76+
6677
const options = {}
6778

6879
enhanceApp({ Vue, options, router })

0 commit comments

Comments
 (0)