vue-router(配置子路由--單頁面多路由區域操作)


1.配置子路由:

import Post from "@components/Post"

export default new Router({

  routers:[

    {

      path:'/',

      component:Pos

    },

    {//配置自由路

      path:'/com',

      compontent:Com,

      children:[

          {

            path:'/'

          },

          {

            path:'com',

            component:Com

          }

        ]

    }

  ]

})

 

2.單頁面多路由區域操作(頁面出現多個router-view --通過name)

<router-view></router-view>

<router-view  name="main"></router-view>

路由配置:

export default new Router({

  routers:[

    path:'/',

    compontents:{

      default:Def,

      main:Main

    }

 

  ]

});

配置中compontents:{}對象;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM