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

您好,函数模式如何动态控制显示隐藏呢 #20

Closed
yumu7777777 opened this issue Dec 13, 2022 · 3 comments
Closed

您好,函数模式如何动态控制显示隐藏呢 #20

yumu7777777 opened this issue Dec 13, 2022 · 3 comments

Comments

@yumu7777777
Copy link

No description provided.

@popdo
Copy link

popdo commented Dec 14, 2022

同问。好像只能设置disabled

@yumu7777777
Copy link
Author

对,不能点的直接不用显示就行啊

imengyu added a commit that referenced this issue Dec 20, 2022
@imengyu
Copy link
Owner

imengyu commented Dec 20, 2022

1.1.6 更新了,在菜单项配置上新增了 hidden 属性用于控制菜单是否隐藏。

你只需要将菜单数据声明为响应式数据,即可动态修改菜单:

const menuData = reactive<MenuOptions>({
  items: [
    { 
      label: 'Simple item',
      hidden: false, //控制是否隐藏
      onClick: () => alert('Click Simple item'),
    },
  ]
});

ContextMenu.showContextMenu(menuData);

//可以在显示菜单后随时更改属性:
menuData.items[0].hidden = true; //动态更改是否隐藏

@imengyu imengyu closed this as completed Jan 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants