| | |
| | | const propsDefault = { |
| | | label: propsConfig.label || 'name', |
| | | path: propsConfig.path || 'path', |
| | | fullPath: propsConfig.fullPath || 'fullPath', |
| | | query:propsConfig.query || 'query', |
| | | icon: propsConfig.icon || 'icon', |
| | | children: propsConfig.children || 'children', |
| | | meta: propsConfig.meta || 'meta', |
| | |
| | | } else { |
| | | return oMenu[propsDefault.path] |
| | | } |
| | | })(); |
| | | let fullPath=path; |
| | | let query=oMenu[propsDefault.query] || {}; |
| | | if(path.indexOf('?')!=-1){ |
| | | let params=path.split('?')[1].split('&'); |
| | | path=path.split('?')[0] |
| | | params.forEach(pitem=>{ |
| | | try { |
| | | query[pitem.split('=')[0]]=pitem.split('=')[1]; |
| | | }catch (e) { |
| | | query[pitem.split('=')[0]]=null; |
| | | } |
| | | |
| | | }) |
| | | } |
| | | })(), |
| | | //特殊处理组件 执行完这个 component 也就是精确到具体的文件了 views文件夹下面就是具体的页面代码 |
| | | let component = 'views' + path, |
| | | component = 'views' + oMenu.path, |
| | | name = oMenu[propsDefault.label], |
| | | icon = oMenu[propsDefault.icon], |
| | | children = oMenu[propsDefault.children], |
| | |
| | | const isChild = children.length !== 0; |
| | | const oRouter = { |
| | | path: path, |
| | | fullPath:fullPath, |
| | | query:query, |
| | | component(resolve) { |
| | | // 判断是否为首路由 |
| | | if (first) { |