diff --git a/src/dropdown/index.js b/src/dropdown/index.js index b6f4ae6..1a39c65 100644 --- a/src/dropdown/index.js +++ b/src/dropdown/index.js @@ -71,11 +71,13 @@ export const hide = ({ api, props, state }) => () => { ) } -export const handleClick = ({ api, props, state }) => () => { +export const handleClick = ({ api, props, state,emit }) => () => { if (props.disabled) { return } + emit('handle-click',state.visible) + state.visible ? api.hide() : api.show() } diff --git a/src/dropdown/vue.js b/src/dropdown/vue.js index 7caa07f..8fabf75 100644 --- a/src/dropdown/vue.js +++ b/src/dropdown/vue.js @@ -56,7 +56,7 @@ export const renderless = (props, { reactive, watch, provide, onMounted }, { emi show: show({ props, state }), hide: hide({ api, props, state }), mounted: mounted({ api, vm }), - handleClick: handleClick({ api, props, state }), + handleClick: handleClick({ api, props, state,emit }), handleTriggerKeyDown: handleTriggerKeyDown({ api, state }), handleItemKeyDown: handleItemKeyDown({ api, props, state }), resetTabindex: resetTabindex({ api }),