Claudiu
Claudiu

Reputation: 633

Vue JS 3, use vue-router 3 instead of 4?

I'm trying to use vue-router 3 instead of vue-router 4 in Vue JS 3. It is possible?

Using @3 instead @next I have the same problem as here:

Vue3 "export 'createWebHistory, createRouter' was not found in 'vue-router'

Upvotes: 2

Views: 1143

Answers (2)

Claudiu
Claudiu

Reputation: 633

The motivation I was trying to fall back to an older version was because I found in a tutorial a very difficult way to use for '*'. A lot of lines of code and regex complexity. Believed that using that way isn't easy and natural. I'm a backend dev and in Python Flask it somehow easier and clear like in Vue JS 2

After digging and digging and digging (I don't understand why the show more complicated way like "router.resolve", etc) I found the this way

{ path: "/:catchAll(.*)", redirect:"/" } .

As a side note as a new Vue JS developer I just found that there are more functions to catch paths:

catchAll, pathMatch, noPage (I will study to understand the difference).

The page that enlighted me was: Vue Router - catch all wildcard not working

Upvotes: 0

Thomas
Thomas

Reputation: 7080

Why would you do that? They built v4 for Vue3: https://github.com/vuejs/vue-router-next

Version 3 was for Vue2.

The features should be the same.

Upvotes: 2

Related Questions