diff --git a/public/json/user.json b/public/json/user.json index 0af42750..a3b01355 100644 --- a/public/json/user.json +++ b/public/json/user.json @@ -15,14 +15,14 @@ "children": [] }, { - "name": "layout2", - "path": "/layout", + "name": "template", + "path": "/template", "meta": { - "title": "组件", + "title": "模板", "icon": "el-icon-files" }, "children": [{ - "path": "/layout/list", + "path": "/template/list", "name": "list", "meta": { "title": "列表" @@ -30,10 +30,11 @@ "component": "list" }, { - "path": "/layout/show", + "path": "/template/show/:id", "name": "show", "meta": { - "title": "详情" + "title": "详情", + "hidden": true }, "component": "show" } diff --git a/src/layout/components/side.vue b/src/layout/components/side.vue index 1421612e..bbb2783b 100644 --- a/src/layout/components/side.vue +++ b/src/layout/components/side.vue @@ -58,27 +58,22 @@ //点击显示 showMenu(route) { this.pmenu = route; - this.nextMenu = route.children; - }, - //根据path获取 - getRoute(path, menu){ - for (var item of menu) { - if (item.path == path) { - return item; - } - if (item.children) { - this.getRoute(path, item.children); - } - } + this.nextMenu = this.filterUrl(route.children); }, //转换外部链接的路由 filterUrl(map){ var newMap = [] map.forEach(item => { item.meta = item.meta?item.meta:{}; + //处理隐藏 + if(item.meta.hidden){ + return false + } + //处理http if(item.path.startsWith('http') && item.meta.target!='_blank'){ item.path = `/${encodeURIComponent(item.path)}`; } + //递归循环 if(item.children&&item.children.length > 0){ this.filterUrl(item.children); } diff --git a/src/layout/components/tags.vue b/src/layout/components/tags.vue index 442b8db0..bd9f3f25 100644 --- a/src/layout/components/tags.vue +++ b/src/layout/components/tags.vue @@ -9,14 +9,15 @@ - -
- + +