Comments (4)
See https://router.vuejs.org/guide/migration/#Removal-of-unnamed-parameters
In particular, what you want is this: https://paths.esm.dev/?p=AAMsIPQgYAwL9gdgGALADgWWMzAFpBLHCWgc4PKyMmA2gLgCbw4OigVg_AC5eGykoA1SD10A1AAAHATokaYUwAAQ&t=/companies/2/page/thing#
from router.
@posva thanks a lot 👍 The neccessary escaping of the closing brace is very weird, though, IMHO
from router.
Additionally, this doesn't fully help with generating a url as the (?:page/([^/]+?\))?
is only a constraint when parsing a path, but has no effect when generating one
const matcher = createRouterMatcher(
[{ name: "someRoute", path: "/prefix/:slug/:page(?:page/(\\d+\\))?" }],
{},
);
matcher.resolve(
{ name: "someRoute", params: { slug: "test-123", page: 4 } },
{ params: {} },
)
// => /prefix/test-123/4
reproduction https://codesandbox.io/p/devbox/qpktzz?file=%2Findex.mjs%3A11%2C1-15%2C1
from router.
Escaping always reads weird.
Yes, you will have to provide the whole param: page/54
. In your specific case though, the /
will be encoded since it's a param so you will need to build the fullpath yourself: router.push(
/prefix/${slug}/page/${page})
. There are plans to improve the handling of the /
encoding in params in the future though
from router.
Related Issues (20)
- 关于beforeRouteLeave是否可以访问this的问题
- A way to detect if user has history on current site HOT 3
- Ability to check if a router has any pages to go back/forward to HOT 1
- Regex in params extract extra characters with any capturing groups HOT 1
- Router instance not found when testing component library integration
- hash decode not match the later encode HOT 2
- Inconsistent trailing slash behaviour with multiple optional parameters HOT 5
- router.push with alias not changing original URL HOT 1
- Route Grouping HOT 1
- createMemoryHistory and createWebHistory differs with base HOT 1
- Optional parameters type missmatch on push and popstate back navigation HOT 1
- Default child not shown when using router-link with name instead of path HOT 3
- router.resolve doesn't include details of the query since 4.3.1
- Why does accessing base automatically add ‘/’ after the route? HOT 3
- Component cached even on a failed network request (vue-router v4.3.2) HOT 2
- Option to prevent adding the Hash (#/) for the Initial route HOT 2
- Parent navigation guard inconsistently re-run when redirecting between child routes HOT 8
- useRouter() returns undefined when uses in setup() method in Options API component HOT 2
- External Type Declaration Causing Inability to Pass certain Route Parameter as Prop in Vue Router 4 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from router.