componentA
<router-view />
<div>
// 省略代码
</div>
componentB
<div>
这里需要跳转到 componentA
<router-link :to="{name:'A',params:{参数}}" tag="div">toA</router-link>
</div>
componentC
<div>
这里需要跳转到 componentA
<router-link :to="{name:'A',params:{参数}}" tag="div">toA</router-link>
</div>
{
path: '/',
name: 'A',
component: () => import( '../views/componentA.vue'),
children: [
{path: 'b', name: 'B', component: () => import('../views/componentB.vue')},
{path: 'c', name: 'C', component: () => import('../views/componentC.vue')},
]
},
但是点击跳转路由后 原本要是再App.vue 的 router-view
打开 componentA 但是奇葩的是居然打不开 咋操作呢?
路由配置这里,你没配置 App.vue 吖
在main.js里
render: h => h(App)
,这里配置了项目入口如果想要 App.vue 里能映射 componentA 组件, App.vue 里要有
<router-view />
并且路由配置