Skip to content

[feature] Passing an additional parameter not to be used in the URL #444

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

Closed
treforcoster opened this issue Apr 1, 2016 · 4 comments
Closed

Comments

@treforcoster
Copy link

I'm trying to call a dynamic route and I have this working really well but what i really need is to be able to pass an extra parameter to the template so that I can use that to specify a page type

for example:

v-link="{ path: "pagename" , params : (pageType : "page"}

is this possible?

I've done a work around using named routes but this is not good for me as I don't want the name of the route appearing in the URL I only want the page name.

@tejitak
Copy link
Contributor

tejitak commented Apr 2, 2016

Alias can be a solution for your example.
Here is a comment on another issue.
#235 (comment)

@fnlctrl
Copy link
Member

fnlctrl commented Apr 2, 2016

Technically any parameter must be passed inside url.
For example, if clicking a link goes to /pagename whose 'type' is 'foo'.
What happens if the user refreshes the page after clicking? Now he hasn't clicked any link, there's no 'type' specified for the page.

If you do want to pass such 'invisible' parameter, use props.
<router-view :type="yourType">
And cache the type value using localStorage afterwards.

@yyx990803
Copy link
Member

What @fnlctrl said: what you are trying to "pass along" is not a URL param, but rather application state. A URL param is by definition part of the URL. You are actually trying to do two things: 1. navigate to the route 2. mutate the application state (pageType).

@treforcoster
Copy link
Author

Thank you guys.. I really couldn't see a way around the problem with out
passing a parameter. For most web apps using the named routes or parameters
in the url would be sufficient but I wanted clean simple URLs.

I will give the props a go and see how I fair with it and take this across
to support if I run into issues.

Thanks for the replies.
On Sat, 2 Apr 2016 at 07:36, Evan You [email protected] wrote:

Closed #444 #444.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#444 (comment)

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

No branches or pull requests

4 participants