Skip to content

Fix an error on the document: #2269

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

Merged
merged 1 commit into from
Dec 2, 2018
Merged

Fix an error on the document: #2269

merged 1 commit into from
Dec 2, 2018

Conversation

YuJianrong
Copy link
Contributor

param value should be string instead of number

@posva
Copy link
Member

posva commented Jun 27, 2018

Thanks for this. I'm not sure we want to force users pass strings. I do think params should be normalised though

@YuJianrong
Copy link
Contributor Author

@posva Em... I think maybe it's better to force the user to use string for the router params, consider:

  1. When the param is part of the url, like /abc/123 for router /abc/:id, the id will be a string instead of number, it may not be a good idea for the user to pass the param as a number pragmatically.
  2. The param member is defined as string in the TypeScript description file so set the param as a number is conflict with the description router.d.ts:
export interface Route {
  path: string;
  name?: string;
  hash: string;
  query: Dictionary<string>;
  params: Dictionary<string>; // <- this one
  fullPath: string;
  matched: RouteRecord[];
  redirectedFrom?: string;
  meta?: any;
}

@posva posva added the docs label Aug 10, 2018
@posva posva merged commit 8598caa into vuejs:dev Dec 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants