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

fix(DropdownMenu): fixed the position error when expanding upwards in… #1598

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading