O
O
Olesya_v2021-05-20 02:09:07
Vue.js
Olesya_v, 2021-05-20 02:09:07

Vue router - nested routing?

Can anyone tell me how to make the routing work when reloading or entering via a nested link
When entering conditionally /cabinet/
and then following the links, the routing works fine, the pages switch like spa
/cabinet/some1/
/cabinet/some2/

but if you reload the page eg /cabinet/some2/ everything breaks down, you need to go back to the start page /cabinet/ where is the routing done?
sorry, just learning vue)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-05-20
@Olesya_v

On server. The server must direct all calls to index.html so that vue-router is already involved in the work there. How to configure your server to buzz "vue router <server name>".
The option is simpler and lazier: switch the router from history mode to hash. Links, of course, will be ugly, but it will immediately work anywhere.
A more difficult option: configure SSR.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question