Skip to content

Commit

Permalink
fix(dropdown): 修复Dropdown组件中placement方向的问题,由12个方向改为只有上下6个方向可选,默认方向为下 (#…
Browse files Browse the repository at this point in the history
…333)

affects: @gio-design/components, website

修复Dropdown组件中placement方向的问题,由12个方向改为只有上下6个方向可选,默认方向为下
  • Loading branch information
WORLDI authored Oct 22, 2020
1 parent f3e1d10 commit 74babad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/components/src/components/dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useContext, cloneElement } from 'react';
import { isFunction } from 'lodash';
import Tooltip from '../tooltip';
import { DropdownProps } from './interface';
import { ConfigContext } from '../config-provider';
import useControlledState from '../../utils/hooks/useControlledState';
import { isFunction } from 'lodash';

const Dropdown = (props: DropdownProps) => {
const placementList = ['top','bottom','topLeft','topRight','bottomLeft','bottomRight'];
const {
children,
prefixCls: customizePrefixCls,
Expand Down Expand Up @@ -33,7 +34,7 @@ const Dropdown = (props: DropdownProps) => {
<Tooltip
prefixCls={prefixCls}
trigger={trigger}
placement={placement}
placement={placementList.includes(placement) ? placement : 'bottom'}
visible={controlledVisible}
overlay={getOverlay()}
onVisibleChange={(_visible) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import '@gio-design/components/es/components/dropdown/style/index.css';

export default () => (
<Dropdown
overlay={
overlay={(
<div
style={{
width: 294,
Expand All @@ -19,7 +19,7 @@ export default () => (
>
内容区域
</div>
}
)}
placement="bottomRight"
>
<Button type="secondary">更多操作</Button>
Expand Down

0 comments on commit 74babad

Please sign in to comment.