不管是在RC开发还是在AWC开发中都经常会遇到开发多级菜单的需求,在这里分享一下在AWC中如何创建多级菜单,并将自定义的菜单加入到系统的命令组中
1:command的创建(较简单,官方文档有详细命令)
1:在stage文件夹下执行initenv.cmd初始化开发环境

2:执行generateModule 脚本

3:输入command

4:输入command名称

5:选择命令图标(图标可自定义)

6:选择命令位置

7:效果如下

以下是一些常见的位置。
1- aw_globalNavigationbar
2 - aw_rightWall
3 - aw_contextMenu2

2:将两个或以上的command添加至同一命令组
1:创建一个作为parentGroupId的command(此例创建的名称是commandGroup),将commandsViewModel.json文件内容修改如下:
"commands": {
"commandGroup": {
"iconId": "cmdAdd",
"isRibbon": true,
"title": "{{i18n.commandGroupTitle}}"
},
"commandHandlers": {
"commandGroupHandler": {
"id": "commandGroup",
"activeWhen": true,
"visibleWhen": true,
"enableWhen": true
},
"commandPlacements": {
"commandGroupaw_globalNavigationbar": {
"id": "commandGroup",
"uiAnchor": "aw_rightWall"
},
2:将需要添加到命令组的command1和command2修改如下
"command1aw_globalNavigationbar": {
"id": "command1",
"uiAnchor": "aw_globalNavigationbar",
"priority": 100,
"parentGroupId": "commandGroup"
},
"command2aw_globalNavigationbar": {
"id": "command2",
"uiAnchor": "aw_globalNavigationbar",
"priority": 100,
"parentGroupId": "commandGroup"
}
3:效果如下所示:

3:将自定义的command添加到系统命令组
1:将自定义的command加到系统自带的命令组中,主要是需要找到系统中自带的组id,参考下图:

2:查找到编辑命令组的id是Awp0EditGroup,将自定义的command的parentGroupId属性设置为Awp0EditGroup即可,效果如下:

本文详述了在AWC开发环境中创建多级菜单的方法,包括command的创建流程、命令组的配置以及如何将自定义command加入系统命令组,助力开发者提升界面定制效率。

429

被折叠的 条评论
为什么被折叠?



