| | |
| | | }, |
| | | //处理路由 |
| | | getPath: function (params) { |
| | | console.log('params',params) |
| | | let {src} = params; |
| | | let result = src || '/'; |
| | | if (isURL(src)) { |
| | |
| | | // 设置 props默认值 作用就是将字段设置成配置的 |
| | | const propsDefault = { |
| | | label: propsConfig.label || 'name', |
| | | path: 'code', |
| | | code: 'code', |
| | | path: propsConfig.path, |
| | | code: 'id',//取唯一标识 |
| | | pathValue: 'pathValue', |
| | | icon: propsConfig.icon || 'icon', |
| | | icon: propsConfig.icon || 'source', |
| | | children: propsConfig.children || 'children', |
| | | meta: propsConfig.meta || 'meta', |
| | | } |
| | |
| | | icon = oMenu[propsDefault.icon], |
| | | children = oMenu[propsDefault.children], |
| | | meta = oMenu[propsDefault.meta] || {}; |
| | | meta.keepAlive=true; |
| | | // meta中 keepalive 的处理 |
| | | meta = Object.assign(meta, (function () { |
| | | if (option.keepAlive === true) { |
| | |
| | | meta: meta, |
| | | redirect: (() => { |
| | | // 第一次进来但是没有子路由的 需要添加redirect |
| | | if (!isChild && first && !isURL(path)) return `${path}/index` |
| | | if (!isChild && first && !isURL(path)) return `/${code}/index` |
| | | else return ''; |
| | | })(), |
| | | // 整理子路由的route 配置 |