HTML 5 Web History #2447
-
I moved up from Vue 2 to Vue 3 recently, and trying to get the HTML 5 Web History working the same way as in Vue 2. So I set the history mode using "createWebHistory", and everything seems fine, except when I click on the same link (ie. on dashboard, then I click on a side menu that go to dashboard again), on Vue 3 (vite), the whole page reload, but in Vue 2 (cli-serve), if I click on the same link, the page will not reload. And if I use createWebHashHistory on Vue 3, the page also won't reload. So am I missing some configuration some where? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I ran into the same issue when migrating to Vue 3 with Ensure the Base URL is Set Correctlyconst router = createRouter({
history: createWebHistory('/'),
routes,
}); Check Server Config (Especially for History Mode)If using Nginx, make sure you have: location / {
try_files $uri /index.html;
} Confirm Link Behavior
The fact that |
Beta Was this translation helpful? Give feedback.
-
That behavior hasn't changed from Vue Router 3 to 4. RouterLink will not reload in both cases. A boiled down repro could help reproduce |
Beta Was this translation helpful? Give feedback.
That behavior hasn't changed from Vue Router 3 to 4. RouterLink will not reload in both cases. A boiled down repro could help reproduce