Skip to content

Commit

Permalink
fix(DropdownMenu): fixed the position error when expanding upwards in…
Browse files Browse the repository at this point in the history
… safari
  • Loading branch information
anlyyao committed Sep 24, 2024
1 parent 8c666df commit 9814245
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/dropdown-menu/dropdown-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import config from '../config';
import TButton from '../button';
import TPopup from '../popup';
import TCheckbox, { CheckboxGroup as TCheckboxGroup } from '../checkbox';
import { useVModel, uniqueFactory } from '../shared';
import { useVModel, uniqueFactory, getWindowSize } from '../shared';
import DropdownItemProps from './dropdown-item-props';
import { DropdownMenuState, DropdownMenuControl } from './context';
import { TdDropdownMenuProps, DropdownValue } from './type';
Expand Down Expand Up @@ -90,11 +90,13 @@ export default defineComponent({
const setExpand = (val: boolean) => {
// 菜单定位
const { bottom, top } = menuState.barRect;
const winHeight = getWindowSize().height;

menuProps.direction === 'up'
? (state.expandStyle = {
transform: menuProps.direction === 'up' ? 'rotateX(180deg) rotateY(180deg)' : '',
zIndex: menuProps.zIndex,
bottom: `calc(100vh - ${top}px)`,
bottom: `${winHeight - top}px`,
})
: (state.expandStyle = {
zIndex: menuProps.zIndex,
Expand Down
1 change: 1 addition & 0 deletions src/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from './util';
export * from './component';
export * from './constants';
export * from './render';
export * from './dom';
export { default as TNode } from './render-tnode';

/* Vue3 use */
Expand Down

0 comments on commit 9814245

Please sign in to comment.