Commit 58cdc0be132964df2997195674a32aed915ca843
1 parent
340790de
fix: fix menu active bug
Showing
6 changed files
with
19 additions
and
17 deletions
sql/mysql/vue3-menu.sql
| @@ -257,7 +257,7 @@ INSERT INTO `system_menu` VALUES (1264, '客户端查询', 'system:oauth2-client | @@ -257,7 +257,7 @@ INSERT INTO `system_menu` VALUES (1264, '客户端查询', 'system:oauth2-client | ||
| 257 | INSERT INTO `system_menu` VALUES (1265, '客户端创建', 'system:oauth2-client:create', 3, 2, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:23', b'0'); | 257 | INSERT INTO `system_menu` VALUES (1265, '客户端创建', 'system:oauth2-client:create', 3, 2, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:23', b'0'); |
| 258 | INSERT INTO `system_menu` VALUES (1266, '客户端更新', 'system:oauth2-client:update', 3, 3, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:28', b'0'); | 258 | INSERT INTO `system_menu` VALUES (1266, '客户端更新', 'system:oauth2-client:update', 3, 3, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:28', b'0'); |
| 259 | INSERT INTO `system_menu` VALUES (1267, '客户端删除', 'system:oauth2-client:delete', 3, 4, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:33', b'0'); | 259 | INSERT INTO `system_menu` VALUES (1267, '客户端删除', 'system:oauth2-client:delete', 3, 4, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:33', b'0'); |
| 260 | -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1281, '可视化报表', '', 1, 12, 0, '/visualization', 'chart', NULL, 0, b'1', b'1', '1', '2022-07-10 20:22:15', '1', '2022-07-10 20:33:30', b'0'); | ||
| 261 | -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1282, '积木报表', '', 2, 1, 1281, 'jimu-report', 'example', 'visualization/jmreport/index', 0, b'1', b'1', '1', '2022-07-10 20:26:36', '1', '2022-07-28 21:17:34', b'0'); | 260 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1281, '可视化报表', '', 1, 12, 0, '/visualization', 'ep:histogram', NULL, 0, b'1', b'1', '1', '2022-07-10 20:22:15', '1', '2022-07-10 20:33:30', b'0'); |
| 261 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1282, '积木报表', '', 2, 1, 1281, 'jimu-report', 'ep:histogram', 'visualization/jmreport/index', 0, b'1', b'1', '1', '2022-07-10 20:26:36', '1', '2022-07-28 21:17:34', b'0'); | ||
| 262 | 262 | ||
| 263 | SET FOREIGN_KEY_CHECKS = 1; | 263 | SET FOREIGN_KEY_CHECKS = 1; |
yudao-ui-admin-vue3/src/api/infra/codegen/types.ts
yudao-ui-admin-vue3/src/components/Menu/src/Menu.vue
| @@ -94,8 +94,8 @@ export default defineComponent({ | @@ -94,8 +94,8 @@ export default defineComponent({ | ||
| 94 | > | 94 | > |
| 95 | {{ | 95 | {{ |
| 96 | default: () => { | 96 | default: () => { |
| 97 | - const { renderMenuItem } = useRenderMenuItem(unref(routers), unref(menuMode)) | ||
| 98 | - return renderMenuItem() | 97 | + const { renderMenuItem } = useRenderMenuItem(unref(menuMode)) |
| 98 | + return renderMenuItem(unref(routers)) | ||
| 99 | } | 99 | } |
| 100 | }} | 100 | }} |
| 101 | </ElMenu> | 101 | </ElMenu> |
yudao-ui-admin-vue3/src/components/Menu/src/components/useRenderMenuItem.tsx
| 1 | import { ElSubMenu, ElMenuItem } from 'element-plus' | 1 | import { ElSubMenu, ElMenuItem } from 'element-plus' |
| 2 | import type { RouteMeta } from 'vue-router' | 2 | import type { RouteMeta } from 'vue-router' |
| 3 | -import { getAllParentPath, hasOneShowingChild } from '../helper' | 3 | +import { hasOneShowingChild } from '../helper' |
| 4 | import { isUrl } from '@/utils/is' | 4 | import { isUrl } from '@/utils/is' |
| 5 | import { useRenderMenuTitle } from './useRenderMenuTitle' | 5 | import { useRenderMenuTitle } from './useRenderMenuTitle' |
| 6 | import { useDesign } from '@/hooks/web/useDesign' | 6 | import { useDesign } from '@/hooks/web/useDesign' |
| 7 | import { pathResolve } from '@/utils/routerHelper' | 7 | import { pathResolve } from '@/utils/routerHelper' |
| 8 | 8 | ||
| 9 | export const useRenderMenuItem = ( | 9 | export const useRenderMenuItem = ( |
| 10 | - allRouters: AppRouteRecordRaw[] = [], | 10 | + // allRouters: AppRouteRecordRaw[] = [], |
| 11 | menuMode: 'vertical' | 'horizontal' | 11 | menuMode: 'vertical' | 'horizontal' |
| 12 | ) => { | 12 | ) => { |
| 13 | - const renderMenuItem = (routers?: AppRouteRecordRaw[]) => { | ||
| 14 | - return (routers || allRouters).map((v) => { | 13 | + const renderMenuItem = (routers: AppRouteRecordRaw[], parentPath = '/') => { |
| 14 | + return routers.map((v) => { | ||
| 15 | const meta = (v.meta ?? {}) as RouteMeta | 15 | const meta = (v.meta ?? {}) as RouteMeta |
| 16 | if (!meta.hidden) { | 16 | if (!meta.hidden) { |
| 17 | const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v) | 17 | const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v) |
| 18 | - const fullPath = isUrl(v.path) | ||
| 19 | - ? v.path | ||
| 20 | - : getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/') | 18 | + const fullPath = isUrl(v.path) ? v.path : pathResolve(parentPath, v.path) // getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/') |
| 21 | 19 | ||
| 22 | const { renderMenuTitle } = useRenderMenuTitle() | 20 | const { renderMenuTitle } = useRenderMenuTitle() |
| 23 | 21 | ||
| @@ -46,7 +44,7 @@ export const useRenderMenuItem = ( | @@ -46,7 +44,7 @@ export const useRenderMenuItem = ( | ||
| 46 | > | 44 | > |
| 47 | {{ | 45 | {{ |
| 48 | title: () => renderMenuTitle(meta), | 46 | title: () => renderMenuTitle(meta), |
| 49 | - default: () => renderMenuItem(v.children) | 47 | + default: () => renderMenuItem(v.children!, fullPath) |
| 50 | }} | 48 | }} |
| 51 | </ElSubMenu> | 49 | </ElSubMenu> |
| 52 | ) | 50 | ) |
yudao-ui-admin-vue3/src/components/TagsView/src/TagsView.vue
| @@ -492,15 +492,12 @@ watch( | @@ -492,15 +492,12 @@ watch( | ||
| 492 | } | 492 | } |
| 493 | } | 493 | } |
| 494 | 494 | ||
| 495 | - &__item + &__item { | ||
| 496 | - margin-left: 4px; | ||
| 497 | - } | ||
| 498 | - | ||
| 499 | &__item { | 495 | &__item { |
| 500 | position: relative; | 496 | position: relative; |
| 501 | top: 2px; | 497 | top: 2px; |
| 502 | height: calc(~'100% - 4px'); | 498 | height: calc(~'100% - 4px'); |
| 503 | padding-right: 25px; | 499 | padding-right: 25px; |
| 500 | + margin-left: 4px; | ||
| 504 | font-size: 12px; | 501 | font-size: 12px; |
| 505 | cursor: pointer; | 502 | cursor: pointer; |
| 506 | border: 1px solid #d9d9d9; | 503 | border: 1px solid #d9d9d9; |
| @@ -528,6 +525,7 @@ watch( | @@ -528,6 +525,7 @@ watch( | ||
| 528 | &__item.is-active { | 525 | &__item.is-active { |
| 529 | color: var(--el-color-white); | 526 | color: var(--el-color-white); |
| 530 | background-color: var(--el-color-primary); | 527 | background-color: var(--el-color-primary); |
| 528 | + border: 1px solid var(--el-color-primary); | ||
| 531 | .@{prefix-cls}__item--close { | 529 | .@{prefix-cls}__item--close { |
| 532 | :deep(span) { | 530 | :deep(span) { |
| 533 | color: var(--el-color-white) !important; | 531 | color: var(--el-color-white) !important; |
yudao-ui-admin-vue3/src/views/Home/Index.vue
| @@ -208,7 +208,12 @@ const getUserAccessSource = async () => { | @@ -208,7 +208,12 @@ const getUserAccessSource = async () => { | ||
| 208 | 'legend.data', | 208 | 'legend.data', |
| 209 | data.map((v) => t(v.name)) | 209 | data.map((v) => t(v.name)) |
| 210 | ) | 210 | ) |
| 211 | - set(pieOptionsData, 'series.data', data) | 211 | + pieOptionsData!.series![0].data = data.map((v) => { |
| 212 | + return { | ||
| 213 | + name: t(v.name), | ||
| 214 | + value: v.value | ||
| 215 | + } | ||
| 216 | + }) | ||
| 212 | } | 217 | } |
| 213 | const barOptionsData = reactive<EChartsOption>(barOptions) as EChartsOption | 218 | const barOptionsData = reactive<EChartsOption>(barOptions) as EChartsOption |
| 214 | 219 |