mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 12:08:13 +08:00
DropDown 开启更多配置
This commit is contained in:
parent
2da3c87311
commit
7030046108
@ -14,6 +14,8 @@ export interface DropDownButtonProps extends RendererProps {
|
||||
buttons?: Array<any>;
|
||||
caretIcon?: string;
|
||||
iconOnly?: boolean;
|
||||
defaultIsOpened?: boolean;
|
||||
closeOnOutside?: boolean;
|
||||
}
|
||||
|
||||
export interface DropDownButtonState {
|
||||
@ -22,7 +24,7 @@ export interface DropDownButtonState {
|
||||
|
||||
export default class DropDownButton extends React.Component<DropDownButtonProps, DropDownButtonState> {
|
||||
state: DropDownButtonState = {
|
||||
isOpened: false,
|
||||
isOpened: this.props.defaultIsOpened || false,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
@ -73,11 +75,12 @@ export default class DropDownButton extends React.Component<DropDownButtonProps,
|
||||
classPrefix: ns,
|
||||
children,
|
||||
align,
|
||||
closeOnClick
|
||||
closeOnClick,
|
||||
closeOnOutside
|
||||
} = this.props;
|
||||
|
||||
let body = (
|
||||
<RootCloseWrapper disabled={!this.state.isOpened} onRootClose={this.close}>
|
||||
<RootCloseWrapper disabled={!this.state.isOpened} onRootClose={closeOnOutside !== false ? this.close: noop}>
|
||||
<ul className={cx('DropDown-menu')} onClick={closeOnClick ? this.close : noop}>
|
||||
{children
|
||||
? children
|
||||
|
Loading…
Reference in New Issue
Block a user