Routing with client frameworks #2533
Replies: 1 comment 1 reply
-
How about this? function back() {
if (typeof window === 'undefined') return
window.history.back()
} The focus of the project so far is to provide a low-level foundation enabling you to build what you want. These tiny utilities aren't the focus at the moment (they can be implemented by the user), but will be in the future. Have you seen https://vike.dev/add? It shows you how to migrate an existing Vite app to Vike. Also, at https://vike.dev/vue-router, there is an example of using Vike with vue-router by using a catch-all route. You can start doing this and then eventually remove vue-router in favor of Vike's router. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I am trying to get clarity around the routing for vike. I currently have a vue SPA that I would like to transition to SSR, and liked the idea of something with a bit more flexibility as opposed to Nuxt. So I am trying out vike. While migrating to vike, I have become confused with the routing.
In the docs it says SSR is turned on by default - which I would assume means that it is server routing. But when I have read the routing part of the docs, it says if you are using vike-vue, it is client side routing. Then there is a section about using vue-router, but it is not recommended, but that the vike-router should be a good replacement. But then it is missing some of the basic functionality of vue-router like back(). That leads me to think I should just use window.history level apis, but when I add it to my code, I get errors due to window not being available in nodejs.
So I am looking for clarity around migrating an existing vue app to vike - specific in relation to the vue router. The given example on how to use vue router is also two years old, and does not have a similar structure to the bati project generator, adding to the confusion.
I appreciate any help on this, thanks!
Beta Was this translation helpful? Give feedback.
All reactions