Skip to content
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

no param support in getRouteBaseName #539

Closed
bayun2 opened this issue Nov 18, 2019 · 5 comments · Fixed by #545
Closed

no param support in getRouteBaseName #539

bayun2 opened this issue Nov 18, 2019 · 5 comments · Fixed by #545

Comments

@bayun2
Copy link

bayun2 commented Nov 18, 2019

Version

v6.3.1

Reproduction link

https://jsbin.com/?html,js,output

Steps to reproduce

app.getRouteBaseName(route.to)

What is expected ?

give the name where route will going

What is actually happening?

give the name of current route

Additional comments?

My old project use getRouteBaseName to get route's name ,not only get current route name

This bug report is available on Nuxt community (#c349)
@ghost ghost added the cmty:bug-report label Nov 18, 2019
@rchl
Copy link
Collaborator

rchl commented Nov 18, 2019

Can you explain your use case in details? There might be another way to achieve what you want to achieve.

@bayun2
Copy link
Author

bayun2 commented Nov 28, 2019

For example, I have two routes '/en/page1' 、'/en/page2'. When i enter page1, i want to get page2's routeName. In old version, i get it by use app.getRouteBaseName(route[page2]), but In latest version, getRouteBaseName abort param, only return current route's routeName. In my case, i get page1's name not page2

@rchl
Copy link
Collaborator

rchl commented Nov 28, 2019

  • getRouteBaseName has never accepted a parameter. At least not since I started working on this module which is a year or so.
  • Your comment still doesn't explain why you need that. If you would explain your use case, maybe I could suggest different way to do the same.
  • If I would go implement such feature, what would be the argument to pass to that function? You can only refer route by its name (as far as I can tell), so if you would have to pass route name then it means that you already know the base name.

@bayun2
Copy link
Author

bayun2 commented Nov 29, 2019

@rchl
Copy link
Collaborator

rchl commented Nov 29, 2019

Crap, you're right. I will fix that. Sorry for talking nonsense. :)

@rchl rchl closed this as completed in #545 Dec 2, 2019
rchl added a commit that referenced this issue Dec 2, 2019
In 8a1c052 the functionality to pass
route to `getRouteBaseName` was accidentally removed. Bring that back
and update documentation to state what's the actual argument. It was
incorrectly specifying `string | RawLocation` as argument while
currently it has to be a `Route`.

Resolves #539
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants