Skip to content

Commit

Permalink
fix: popover reClick position bug
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed May 28, 2024
1 parent bb92210 commit d2e3f0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/playground/src/helpers/mock-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const tangoConfigJson = {
},
'@music163/antd': {
description: '云音乐低代码中后台应用基础物料',
version: '0.2.5',
version: '0.2.6',
library: 'TangoAntd',
type: 'baseDependency',
resources: [
Expand Down
7 changes: 6 additions & 1 deletion packages/ui/src/popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,19 @@ export const Popover: React.FC<PopoverProps> = ({
const handleClick = useCallback(
(e: React.MouseEvent) => {
e.preventDefault();
if (visible) {
setVisible(false);
onOpenChange(false);
return;
}
const x = e.clientX;
const y = e.clientY;
setLeft(x);
setTop(y + 10);
setVisible(true);
onOpenChange(true);
},
[onOpenChange],
[visible, onOpenChange],
);

useEffect(() => {
Expand Down

0 comments on commit d2e3f0b

Please sign in to comment.