Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.1k views
in Technique[技术] by (71.8m points)

vue中多个<router-view>在不用页面上要怎么指定路由?

首先在App.vue中有一个<router-view/>了,然后还有另一个Home.vue,里面也有一个<router-view>

路由配置如下:

{
     path: '/',
     name: 'Home',
     component:  () => import('@/views/Home.vue')
}

当访问/时,将Home.vue渲染到App.vue组件中,然后再将Test.vue组件渲染到Home.vue中,这时要怎么配置路由才能将Test.vue渲染到Home.vue中


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

{

 path: '/',
 name: 'Home',
 component:  () => import('@/views/Home.vue'),
 children:[
    {
        path:'test'
        name: 'Test',
        component:  () => import('@/views/Test.vue'),
    }
 ]

}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...