diff --git a/src/components/layout/index.vue b/src/components/layout/index.vue index 5ca4f11c88dc210e1bdf2dd23be3ce1474f3a6fc..3a14ba9a185a27e99b1d979b3bbc7e4128ed7c26 100644 --- a/src/components/layout/index.vue +++ b/src/components/layout/index.vue @@ -2,13 +2,13 @@ + background-color="#545c64" text-color="#fff" router active-text-color="#ffd04b"> 消息中心 diff --git a/src/utils/modules/routeUtils.js b/src/utils/modules/routeUtils.js index 60d92e1c31f8c6672fae0044536cf943f394559c..64bac93aa3b328bce2cd2c5a97a0429b88d9b28c 100644 --- a/src/utils/modules/routeUtils.js +++ b/src/utils/modules/routeUtils.js @@ -4,13 +4,16 @@ * @param {Function} processFn 处理函数 * @returns {Array} 数组数据 */ -export function coventRouteData(list, processFn) { +export function coventRouteData(list, processFn, Parentpath="/") { return list.map(item => { - let { children, component, ...rest } = item; + let { children, path, component, ...rest } = item; + if(!path.startsWith('/')){ + path = Parentpath+path + } if (children && Array.isArray(children)) { - children = coventRouteData(children, processFn) - return processFn({ children, ...rest }) + children = coventRouteData(children, processFn, `${path}/`) + return processFn({ children, path, ...rest }) } - return processFn(rest) + return processFn({path, ...rest}) }); }