| | |
| | | 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文件夹下面就是具体的页面代码 |
| | | component = 'views' + oMenu.path, |
| | | let component = 'views' + 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) { |
| | |
| | | openMenu(item = {}) { |
| | | this.$store.dispatch("GetMenu", item.id).then(data => { |
| | | if (data.length !== 0) { |
| | | debugger; |
| | | this.$router.$avueRouter.formatRoutes(data, true); |
| | | } |
| | | //当点击顶部菜单后默认打开第一个菜单 |
| | |
| | | <template> |
| | | <div> |
| | | <keep-alive> |
| | | <router-view class="avue-view" v-if="$route.meta.keepAlive" /> |
| | | <router-view class="avue-view" v-if="$route.meta.keepAlive" :key="$route.fullPath"/> |
| | | </keep-alive> |
| | | <router-view class="avue-view" v-if="!$route.meta.keepAlive" /> |
| | | <router-view class="avue-view" v-if="!$route.meta.keepAlive" :key="$route.fullPath"/> |
| | | </div> |
| | | </template> |
| | |
| | | next({path: '/login'}) |
| | | }) |
| | | } else { |
| | | const value = to.query.src || to.fullPath; |
| | | const label = to.query.name || to.name; |
| | | let query=JSON.parse(JSON.stringify(to.query)); |
| | | for(var q in to.query) { |
| | | if (to.query[q].indexOf('@name=') != -1) { |
| | | query[q] = to.query[q].split('@name=')[0] |
| | | query['name'] = to.query[q].split('@name=')[1] |
| | | } |
| | | } |
| | | const value = query.src || to.fullPath|| to.path ; |
| | | const label = query.name || to.name; |
| | | const meta = to.meta || router.$avueRouter.meta || {}; |
| | | const i18n = to.query.i18n; |
| | | if (to.query.target) { |
| | |
| | | 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文件夹下面就是具体的页面代码 |
| | | component = 'views' + oMenu.path, |
| | | let component = 'views' + 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, |
| | | params:query, |
| | | component(resolve) { |
| | | // 判断是否为首路由 |
| | | if (first) { |
| | |
| | | // for循环结束 |
| | | // 这个first 卡的其实就是首路由 |
| | | if (first) { |
| | | debugger; |
| | | this.safe.$router.addRoutes(aRouter) |
| | | } else { |
| | | // 这里返回的是子组件 |