在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Android  HTML/ vue-router中的抽象路由

vue-router中的抽象路由

vue-router中有沒有類似angular中的抽象路由?

{
    path:'/'
    children:[
        {
            path:'demo'
            children:[
                {
                    path:'foo'
                    component:foo
                },
                {
                    path:'bar'
                    component:bar
                }
            ]
        }
    ]
}

比如path:'demo'的路由是一個(gè)abstract抽象路由,demo這個(gè)路由并不對(duì)應(yīng)任何的路由出口,只是一個(gè)抽象的層級(jí)關(guān)系。

{
    path:'/'
    children:[
        {
            {
                path:'demo/foo'
                component:foo
            },
            {
                path:'demo/bar'
                component:bar
            }
        }
    ]
}

可以寫成上面的形式來使demo不對(duì)應(yīng)任何路由出口,但是又想使用真正的層級(jí)關(guān)系。
如何實(shí)現(xiàn)?

回答
編輯回答
笨笨噠
{
    path:'/'
    component:main
    children:[
        {
            path:'demo'
            component:{template:"<div><router-view/></div>"},
            redirect:"/404"
            children:[
                {
                    path:'foo'
                    component:foo
                },
                {
                    path:'bar'
                    component:bar
                }
            ]
        }
    ]
}

暫時(shí)使用上面的形式模擬angular-ui-router中的abstract抽象路由

2018年8月28日 18:42