Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] ListTable.menu 右键菜单html渲染模式是否可以支持设定类名,以便覆写菜单样式 #2032

Open
mzhang-eric opened this issue Jul 3, 2024 · 0 comments
Labels
feature 新需求 good first issue Good for newcomers

Comments

@mzhang-eric
Copy link

mzhang-eric commented Jul 3, 2024

What problem does this feature solve?

目前ListTable.menu推荐使用html渲染模式,contextMenuItems 中可以传入 MenuListItem,其定义如下:

type MenuListItem =
  | string
  | {
      text?: string;
      type?: 'title' | 'item' | 'split';
      menuKey?: string;
      icon?: Icon;
      selectedIcon?: Icon;
      stateIcon?: Icon;
      children?: MenuListItem[];
    };

从文档看当前版本 option 中没有 menuStyle 的配置项,无法通过配置项修改右键菜单的样式,但是可以通过在样式中增加对应的样式来覆盖默认样式,例如:

.vtable__menu-element{
    background-color: #fff;
    min-width: 160px;

    .vtable__menu-element__item:not(.vtable__menu-element__split){
      height: 24px;
      padding: 1px 8px;

      .vtable__menu-element__content{
        font-size: 14px;
        font-weight: 400;
        color: #555;
        white-space: nowrap;
      }
    }
  }

但仍然存在一些问题,无法区分主菜单和子菜单,因为右键菜单的html结构中无法指定类名,子菜单也没有类似sub开头的类名来标识它是子菜单,因此无法针对各级菜单做定制化样式

What does the proposed API look like?

1.希望配置项中能有提供类似 menuStyle 的配置项
2.希望 MenuListItem 能够增加类名属性,便于开发者在样式覆写时能够准确定位到菜单和子菜单

@mzhang-eric mzhang-eric added the feature 新需求 label Jul 3, 2024
@mzhang-eric mzhang-eric changed the title [Feature] ListTable.menu 右键菜单html渲染模式是否可以支持设定类名,从而可以更便利的设置右键菜单样式 [Feature] ListTable.menu 右键菜单html渲染模式是否可以支持设定类名,以便覆写菜单样式 Jul 3, 2024
@fangsmile fangsmile added the good first issue Good for newcomers label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 新需求 good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants