菜单管理支持配置路由参数

This commit is contained in:
RuoYi
2021-09-08 09:28:23 +08:00
parent 4988b585f8
commit a5e38f6f99
10 changed files with 169 additions and 119 deletions

View File

@ -10,7 +10,7 @@ import { isExternal } from '@/utils/validate'
export default {
props: {
to: {
type: String,
type: [String, Object],
required: true
}
},

View File

@ -1,7 +1,7 @@
<template>
<div v-if="!item.hidden">
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path, onlyOneChild.query)">
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
</el-menu-item>
@ -82,13 +82,17 @@ export default {
return false
},
resolvePath(routePath) {
resolvePath(routePath, routeQuery) {
if (isExternal(routePath)) {
return routePath
}
if (isExternal(this.basePath)) {
return this.basePath
}
if (routeQuery) {
let query = JSON.parse(routeQuery);
return { path: path.resolve(this.basePath, routePath), query: query }
}
return path.resolve(this.basePath, routePath)
}
}