Vue.js (VueJS)vue路由器匹配多个路径

Vue.js (VueJS)vue路由器匹配多个路径,vue.js,vuejs2,vue-router,Vue.js,Vuejs2,Vue Router,我正在使用vue路由器,并希望匹配两个非常不同的路径。是否可以使用某种数组表示法?您可以在路由中使用别名: routes: [ { path: '/foo', component: Foo, alias: '/bar'} ] 这里有一些很好的例子: 实现这一目标的最佳方法是: { path: '/internalplatforms', alias: ['/a_internalplatforms', '/b_internalplatforms'], name: 'Im

我正在使用vue路由器,并希望匹配两个非常不同的路径。是否可以使用某种数组表示法?

您可以在路由中使用别名:

routes: [
  { path: '/foo', component: Foo, alias: '/bar'}
]
这里有一些很好的例子:


实现这一目标的最佳方法是:

{
    path: '/internalplatforms',
    alias: ['/a_internalplatforms', '/b_internalplatforms'],
    name: 'ImportantPlatform',
    component: ImportantPlatform
}
通过别名,您可以调用InternalPlatform或a_InternalPlatform或b_InternalPlatform,它将显示相同的组件