40

I am using vue-router, and am looking to match two very distinct paths. Is there some kind of array notation I can use?

2 Answers 2

61

You can use an alias in the routes:

routes: [
  { path: '/foo', component: Foo, alias: '/bar'}
]

There are some nice examples here:

https://github.com/vuejs/vue-router/blob/dev/examples/route-alias/app.js

Sign up to request clarification or add additional context in comments.

Comments

10

Best way to achive this is :

{
    path: '/internalplatforms',
    alias: ['/a_internalplatforms', '/b_internalplatforms'],
    name: 'ImportantPlatform',
    component: ImportantPlatform
}

By aliasing, you can call internalplatforms or a_internalplatforms or b_internalplatforms and it will show that same component.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.