diff --git a/lib/app/app.js b/lib/app/app.js index a46aa7062e..4db19c1acc 100644 --- a/lib/app/app.js +++ b/lib/app/app.js @@ -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 })