Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to establish a child route for vue

Shulou Source: shulou.com Published: 2022-05-31 13:25:02 09月29日 Update

In this article, the editor introduces in detail "how to establish sub-routing in vue". The content is detailed, the steps are clear, and the details are handled properly. I hope this "how to establish sub-routing in vue" article can help you solve your doubts.

The specific steps are as follows:

1. First, create a new html project and introduce vue and vue-router into the project

Import Vue from 'vue'

Import Router from 'vue-router'

After the introduction of 2.vue and vue-router, use the Vue.use method to register routes in the project

Vue.use (Router)

3. After the route is registered, define a route on the page

Export default new Router ({

Routes: [

{

Path:'/

Name: 'Home'

Component: HelloWorld

Children: [

{path:'/', component: Child}

]

}

]

})

4. Finally, after the route is defined, add the child routing path to the children attribute.

Export default new Router ({

Routes: [

{

Path:'/

Name: 'Home'

Component: HelloWorld

Children: [

{path:'/', component: Child}

{path:'/Mes/Child', component: Child}

]

}

]

})

After reading this, the article "how to build sub-routes in vue" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.

Tags: Routes posts articles projects content steps appropriateness attributes ideas new knowledge methods more knowledge knowledge points articles details industry information information channels follow Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL NVidia macOS Docker OPPO Reno