Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.7k 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 Reply

0 votes
by (71.8m points)

{

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

}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...