Skip to content

tsx模式开发中<Dropdown >的trigger属性提示的contextMenu无效 #3609

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

Closed
1 task done
kingshuaishuai opened this issue Jan 28, 2021 · 1 comment
Closed
1 task done
Labels

Comments

@kingshuaishuai
Copy link

kingshuaishuai commented Jan 28, 2021

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.0.0-rc.9

Environment

macOS bigsur, Chrome: Version 88.0.4324.96 (Official Build) (x86_64), Vue: 3.0.0

Reproduction link

https://github.com/vueComponent/ant-design-vue

Steps to reproduce

tsx中使用如下代码右键菜单不生效

<Dropdown
trigger={['contextMenu']}
overlay={
<Menu>
<Menu.Item key="1">撤回</Menu.Item>
</Menu>
}
>
<div style={{width: '300px', height: '200px', background: '#f5f5f5'}}>
click here
</div>
</Dropdown>

contextMenu改为非驼峰: contextmenu会报错,无法使用,将浏览器提示错误的蒙层隐藏后发现右键菜单生效

<Dropdown
trigger={['contextmenu']}
overlay={
<Menu>
<Menu.Item key="1">撤回</Menu.Item>
</Menu>
}
>
<div style={{width: '300px', height: '200px', background: '#f5f5f5'}}>
click here
</div>
</Dropdown>

What is expected?

期望不要报错,支持contextMenu或者将类型改为contextmenu的提示

What is actually happening?

  1. tsx模式开发中的trigger属性提示的contextMenu无效
  2. 代码提示:trigger?: ("click" | "hover" | "contextMenu")[] | undefined
  3. 改为contextmenu有效,但是会报错,浏览器会有蒙层报错,inspect将蒙层display: none之后,点击右键生效。

总结: 应该是类型定义的时候写错了,tsx中无法使用这个属性


使用tsx开发时准备使用右键菜单,发现无法使用

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants