【VUE】vue动态路由,配置后端

gengboxb 564 0

为路由添加数据

this.$router.addRoutes(menuDataResolve);

后端返回的数据格式

{
    "id": 1,
    "name": "列表",
    "type": 3,
    "resKey": "list",
    "path": "/list",
    "children": [
                    {
                        "id": 12,
                        "name": "视频",
                        "type": 1,
                        "resKey": "video",
                        "path": "/list/video",
                        "children": [
                            {
                                "id": 13,
                                "name": "详情",
                                "type": 5,
                                "resKey": "details",
                                "path": "/list/video/details",
                                "children": [
                                    {
                                        "id": 28,
                                        "name": "下载",
                                        "type": 2,
                                        "resKey": "downLoadBtn",
                                        "path": "/",
                                        "children": []
                                    }
                                ]
                            },
                        ]
                    },
    ]
}

发表评论 取消回复
表情 图片 链接 代码

分享