Open
Description
Naming your file [...path].vue
generates the router path :path(.*)
.
This is documented here: https://uvr.esm.is/guide/file-based-routing.html#catch-all-404-not-found-route
Vue Router documentation recommends using a repeated regex for catch-all routes, i.e. :path(.*)*
(note extra star at the end).
See: https://router.vuejs.org/guide/essentials/dynamic-matching#Catch-all-404-Not-found-Route
There difference is subtle but observable.
First: the path
parameter is a string "/a/b/c"
with unplugin, and a parsed array ["a", "b", "c"]
with router syntax.
Second: I would like to navigate to a catch-all route with a specific URL. It's impossible to do with unplugin, consider this:
// Unplugin :path(.*)
router.push({ name: "catch-all", params: { path: "a/b/c" } })
// Location is escaped into: /a%2fb%2fc
// Vue Router : path(.*)*
router.push({ name: "catch-all", params: { path: ["a", "b", "c"] })
// Location is /a/b/c
Metadata
Assignees
Labels
Projects
Status
🆕 New