npm run serve
the repo- navigate to localhost:8080/spa/about (/spa is the router base)
- browser will be redirected to
/
infinitely because of therouter-link
referencing a redirect route
The route redirect function will only be run on link click
The route redirect function is being run on load
{
path: "/",
beforeEnter() {
window.location.href = "/";
}
}
I have a project where domain.com/
is a static site. The Vue SPA is being served on domain.com/base
. However, there is no content directly on /base
, but only on /base/something
Therefore, if someone tries to access /base
the best user experience is to redirect them out of the SPA ecosystem back to domain.com/
. To do this, the /
route is set to redirect with location.href = '/'
, but that is being triggered immediately when a router-link
references that route, even if the user doesn't click it.
npm install
npm run serve
npm run build
npm run lint