parent
9c0464d072
commit
0f833cb536
|
@ -23,9 +23,6 @@ export default defineComponent({
|
|||
emits: ['click', 'visibleChange', 'update:visible'],
|
||||
slots: ['icon', 'leftButton', 'rightButton', 'overlay'],
|
||||
setup(props, { slots, attrs, emit }) {
|
||||
const handleClick = (e: MouseEvent) => {
|
||||
emit('click', e);
|
||||
};
|
||||
const handleVisibleChange = (val: boolean) => {
|
||||
emit('update:visible', val);
|
||||
emit('visibleChange', val);
|
||||
|
@ -43,13 +40,15 @@ export default defineComponent({
|
|||
trigger,
|
||||
align,
|
||||
visible,
|
||||
onVisibleChange,
|
||||
onVisibleChange: _onVisibleChange,
|
||||
placement = direction.value === 'rtl' ? 'bottomLeft' : 'bottomRight',
|
||||
href,
|
||||
title,
|
||||
icon = slots.icon?.() || <EllipsisOutlined />,
|
||||
mouseEnterDelay,
|
||||
mouseLeaveDelay,
|
||||
onClick,
|
||||
'onUpdate:visible': _updateVisible,
|
||||
...restProps
|
||||
} = { ...props, ...attrs };
|
||||
|
||||
|
@ -69,7 +68,7 @@ export default defineComponent({
|
|||
<Button
|
||||
type={type}
|
||||
disabled={disabled}
|
||||
onClick={handleClick}
|
||||
onClick={onClick}
|
||||
htmlType={htmlType}
|
||||
href={href}
|
||||
title={title}
|
||||
|
|
|
@ -135,7 +135,7 @@ const Dropdown = defineComponent({
|
|||
onVisibleChange: handleVisibleChange,
|
||||
placement: placement.value,
|
||||
},
|
||||
['overlay'],
|
||||
['overlay', 'onUpdate:visible'],
|
||||
);
|
||||
return (
|
||||
<RcDropdown {...dropdownProps} v-slots={{ overlay: renderOverlay }}>
|
||||
|
|
|
@ -3,6 +3,7 @@ import type { PropType } from 'vue';
|
|||
import PropTypes from '../_util/vue-types';
|
||||
|
||||
import buttonTypes from '../button/buttonTypes';
|
||||
import type { MouseEventHandler } from '../_util/EventInterface';
|
||||
|
||||
type Align = {
|
||||
points?: [string, string];
|
||||
|
@ -40,6 +41,12 @@ const dropdownProps = () => ({
|
|||
mouseLeaveDelay: PropTypes.number,
|
||||
openClassName: PropTypes.string,
|
||||
minOverlayWidthMatchTrigger: PropTypes.looseBool,
|
||||
onVisibleChange: {
|
||||
type: Function as PropType<(val: boolean) => void>,
|
||||
},
|
||||
'onUpdate:visible': {
|
||||
type: Function as PropType<(val: boolean) => void>,
|
||||
},
|
||||
});
|
||||
|
||||
const ButtonTypesProps = buttonTypes();
|
||||
|
@ -53,6 +60,9 @@ const dropdownButtonProps = () => ({
|
|||
prefixCls: PropTypes.string,
|
||||
icon: PropTypes.any,
|
||||
title: PropTypes.string,
|
||||
onClick: {
|
||||
type: Function as PropType<MouseEventHandler>,
|
||||
},
|
||||
});
|
||||
|
||||
export { dropdownProps, dropdownButtonProps };
|
||||
|
|
Loading…
Reference in New Issue