Menu System 
The a-menu module provides a generic menu system. In fact, this menu system can be completely ignored, and your own menu retrieval logic can be provided. However, using a system-defined menu system facilitates the sharing and reuse of code resources within the community, significantly improving the system's scalability and maintainability
bean.menu 
The module a-menu provides a global bean bean.menu, which allows for the unified retrieval of menus
Taking the module home-base as an example:
src/suite/a-home/modules/home-base/src/service/menu.ts
typescript
class ServiceMenu {
  async retrieveMenus(publicPath?: string): Promise<IMenus> {
    return await this.bean.menu.retrieveMenus(publicPath, async () => {
      return this._getMenusDefault();
    });
  }
  private _getMenusDefault(): IMenus {
    return {
      menus: [
        { name: 'home', title: this.$scope.homeIndex.locale.Home(), icon: '::home', link: '/' },
      ],
    };
  }
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
bean.menu.retrieveMenus: Retrieves the menus_getMenusDefault: Provides the default menus
bean.menu.retrieveMenus 
typescript
class BeanMenu {
  async retrieveMenus(
    publicPath?: string,
    nextOrDefault?: NextEventStrict<TypeEventRetrieveMenusData, TypeEventRetrieveMenusResult> | TypeEventRetrieveMenusResult,
  ): Promise<TypeEventRetrieveMenusResult> {
    return await this.scope.event.retrieveMenus.emit({ publicPath }, nextOrDefault);
  }
}1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
- Parameters
 
| Name | Description | 
|---|---|
| publicPath | URL path, can provide different menus for different paths | 
| nextOrDefault | Retrieves the default menus | 
- The 
retrieveMenusmethod raises an eventa-menu:retrieveMenus - The 
a-menu:retrieveMenusevent uses the onion model. You can add event listeners to implement custom menu retrieval logic 
Menu API 
The home-base module provides an API for retrieving the menus, making it out-of-the-box
src/suite/a-home/modules/home-base/src/controller/menu.ts
typescript
class ControllerMenu {
  @Web.get(':publicPath?')
  @Api.body(v.object(DtoMenus))
  async retrieveMenus(@Arg.param('publicPath', v.optional()) publicPath?: string): Promise<IMenus> {
    return await this.scope.service.menu.retrieveMenus(publicPath);
  }
}1
2
3
4
5
6
7
2
3
4
5
6
7