-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
missing param for named route "notfound": Expected "0" to be defined #724
Comments
Hi, thanks for filling this issue. Please follow the Issue Reporting Guidelines and provide a live example on jsfiddle, codepen etc. Thanks! |
Your link is 404, and I can't fit the entire app in a fiddle. |
Sorry about the CONTRIBUTING.md being missing... We'll fix that. The example should only contain the minimal code that will reproduce the error, so you don't need to fit the entire app in a fiddle. |
Closing due to inactivity. |
Same error. If i go to a route with params. And there is no blog post with dat param i want to show a 404 page. by doing: |
same here |
Same error, I don't know why; routes: [{
name: '404',
path: '/404',
component: NotFound
}, {
path: '*',
redirect: '404'
}
] |
I have the same error: // routes.js
export default [
{
path: '/',
name: 'home',
component: HomePage,
},
{
path: '*',
name: 'errors.404',
component: Error404Page,
},
]; You need at least two components in order to trigger the error. |
The problem is that you cannot replace the current view with a named route that has an asterisk path, what you have to do is replace with an explicit path that will match the path like |
replace
by
|
Is there a way to redirect a params that doesn't exist to an error page without changing the URL? I would like to keep the URL as user entered.
|
@amfische your page component should be able to render an error page without redirecting, then. |
@skyrpex Yes that's true, I can put some logic into my page component to render an error page, but I was hoping I could reuse my I have a general error component for nonexistent urls: It would be nice if I could reuse this for router params that don't exist without changing the URL. I tried playing with vue-router alias's but I don't think it will do what I'm trying to do. |
I don't think that's possible... What I did once was redirect to a generic error page, but passing the invalid URL as parameter so I could display information about the other page. |
The fact is that when you do redirect to an asterisk, the router does not know which path should be in the location. You must pass this path yourself, eg:
Here is a piece of my code from route guard for subdomains support, maybe useful
|
Removing 'name' from the object worked for me! |
@amfische @skyrpex |
skip to router name,and replace the url, done ! |
I got this quite cryptic error message and I'm not sure what to make of it.
Relevant trace
Offending code in
edit.vue
Relevant
routes
NotFound.vue
The text was updated successfully, but these errors were encountered: