In my router.ts
file, I have defined two routes:
export default new Router({
mode: "history",
routes: [
{ path: "/", component: require("./components/dashboard/Dashboard.vue")},
{ path: "/counter", component: require("./components/counter/Counter.vue") }
],
});
Vue.use((Router) as any);
When I directly visit http://localhost:5000/counter in the browser, it redirects me to the "/" route instead of the "/counter" route. The same issue occurs when I reload the page. However, if I navigate to /counter using:
<router-link to="/counter">Counter</router-link>
and then reload the page, the counter page does not show up anymore and defaults back to the home route. This is happening on localhost without the involvement of Nginx or similar services, as explained here: https://router.vuejs.org/en/essentials/history-mode.html