vue-template 路由的配置示例

152 阅读1分钟
  <script>
        // const Abc = () => import('@/views/abc');// 路由配置中
        
        // 路由是后端接口返回的
        let obj = {
            "path": "xx",
            "component": "xx",
            "hidden": false,
            "children": [
                {
                    "path": "xx",
                    "component": "Abc",// 前端router配置中配置的名字
                    // "alwaysShow": true,   // 设置为true时,子菜单只有一个时直接显示子菜单
                    "children": [
                        {
                            "path": "xxx",
                            "component": "xxx",
                            "hidden": false,
                            "meta": {
                                "title": "xxx"
                            },
                            "name": "xxx"
                        },
                        {
                            "path": "xx",
                            "component": "xxx",
                            "hidden": true,
                            "meta": {
                                "title": "xx"
                            },
                            "name": "xx"
                        },
                    ],
                    "hidden": false,
                    "meta": {
                        "title": "xx"
                    },
                    "name": "xxx"
                },]
        }
    </script>