Skip to content

Commit

Permalink
fix: redirect /foo to /foo/ during dev (close #183)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 20, 2018
1 parent 748fa7f commit 99bc0aa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down

0 comments on commit 99bc0aa

Please sign in to comment.