Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Example get route param #15

Open
mahadoang opened this issue Oct 9, 2018 · 1 comment
Open

Example get route param #15

mahadoang opened this issue Oct 9, 2018 · 1 comment

Comments

@mahadoang
Copy link

How to get param from router

<RouterLink to="/doc/123">Document</RouterLink>

How to get param document_id in DocumentDetail component

export default {
  mode: 'history',
  routes: {
    '/': Home,
    '/doc': Document,
    '/doc/:document_id':DocumentDetail,
    default: NotFound
  }
}

Thank you.

@alexrdz
Copy link

alexrdz commented Nov 30, 2018

@mahadoang Not sure if this is the official way to do it but you can get the param using this.options.data.path.p in your DocumentDetail component from your example. Or you can inspect this.options.data.path to get the path info. Hope that helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants