diff --git a/components/dropdown/demo/dropdown-button.md b/components/dropdown/demo/dropdown-button.md index bd164a7aa6..c4fddb9d7d 100644 --- a/components/dropdown/demo/dropdown-button.md +++ b/components/dropdown/demo/dropdown-button.md @@ -10,22 +10,24 @@ import { Menu, Dropdown } from 'antd'; const DropdownButton = Dropdown.Button; +function handleButtonClick() { + console.log('click button'); +} + +function handleMenuClick(e) { + console.log('click', e); +} + const menu = ( - - - 第一个菜单项 - - - 第二个菜单项 - - - 第三个菜单项 - + + 第一个菜单项 + 第二个菜单项 + 第三个菜单项 ); ReactDOM.render( - + 某功能按钮 , mountNode); diff --git a/components/dropdown/dropdown-button.jsx b/components/dropdown/dropdown-button.jsx index c722d62820..675f97c5c9 100644 --- a/components/dropdown/dropdown-button.jsx +++ b/components/dropdown/dropdown-button.jsx @@ -3,32 +3,34 @@ import Button from '../button'; import Icon from '../icon'; import Dropdown from './dropdown'; const ButtonGroup = Button.Group; - -const align = { - points: ['tr', 'br'], - overlay: { - adjustX: 1, - adjustY: 1, - }, - offset: [0, 4], - targetOffset: [0, 0], -}; +import classNames from 'classnames'; export default React.createClass({ getDefaultProps() { return { - align, + align: { + points: ['tr', 'br'], + overlay: { + adjustX: 1, + adjustY: 1, + }, + offset: [0, 4], + targetOffset: [0, 0], + }, type: 'default', }; }, render() { + const { type, overlay, trigger, align, children, className, ...restProps } = this.props; + const cls = classNames({ + 'ant-dropdown-button': true, + className: !!className, + }); return ( - - - - + +