diff --git a/packages/@core/ui-kit/menu-ui/src/index.ts b/packages/@core/ui-kit/menu-ui/src/index.ts
index 575a2330910..1e3bc143b4a 100644
--- a/packages/@core/ui-kit/menu-ui/src/index.ts
+++ b/packages/@core/ui-kit/menu-ui/src/index.ts
@@ -1,3 +1,4 @@
+export { default as MenuBadge } from './components/menu-badge.vue';
export * from './components/normal-menu';
export { default as Menu } from './menu.vue';
export type * from './types';
diff --git a/packages/stores/src/modules/access.ts b/packages/stores/src/modules/access.ts
index ee8641a7f71..6b445207647 100644
--- a/packages/stores/src/modules/access.ts
+++ b/packages/stores/src/modules/access.ts
@@ -41,6 +41,25 @@ interface AccessState {
*/
export const useAccessStore = defineStore('core-access', {
actions: {
+ getMenuByPath(path: string) {
+ function findMenu(
+ menus: MenuRecordRaw[],
+ path: string,
+ ): MenuRecordRaw | undefined {
+ for (const menu of menus) {
+ if (menu.path === path) {
+ return menu;
+ }
+ if (menu.children) {
+ const matched = findMenu(menu.children, path);
+ if (matched) {
+ return matched;
+ }
+ }
+ }
+ }
+ return findMenu(this.accessMenus, path);
+ },
setAccessCodes(codes: string[]) {
this.accessCodes = codes;
},
diff --git a/playground/package.json b/playground/package.json
index 5518c17fbaa..720622e09aa 100644
--- a/playground/package.json
+++ b/playground/package.json
@@ -30,6 +30,7 @@
},
"dependencies": {
"@tanstack/vue-query": "catalog:",
+ "@vben-core/menu-ui": "workspace:*",
"@vben/access": "workspace:*",
"@vben/common-ui": "workspace:*",
"@vben/constants": "workspace:*",
diff --git a/playground/src/views/demos/badge/index.vue b/playground/src/views/demos/badge/index.vue
index 92d70c7e170..8976c6fe8c3 100644
--- a/playground/src/views/demos/badge/index.vue
+++ b/playground/src/views/demos/badge/index.vue
@@ -1,7 +1,116 @@
-
+
+
+
+
+
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ce181fe103a..2de4ab5ba07 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1768,6 +1768,9 @@ importers:
'@tanstack/vue-query':
specifier: 'catalog:'
version: 5.62.7(vue@3.5.13(typescript@5.7.2))
+ '@vben-core/menu-ui':
+ specifier: workspace:*
+ version: link:../packages/@core/ui-kit/menu-ui
'@vben/access':
specifier: workspace:*
version: link:../packages/effects/access