Skip to content

Commit

Permalink
fix(onClickOutside): missing options for component
Browse files Browse the repository at this point in the history
It adds support for the options property when using onClickOutside via component
  • Loading branch information
fiadone committed Nov 1, 2022
1 parent 1ec89d6 commit 62fadcd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/core/onClickOutside/component.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import { defineComponent, h, ref } from 'vue-demi'
import { onClickOutside } from '@vueuse/core'
import type { RenderableComponent } from '../types'
import type { OnClickOutsideOptions } from '.'

export const OnClickOutside = defineComponent<RenderableComponent>({
export interface OnClickOutsideProps extends RenderableComponent {
options?: OnClickOutsideOptions
}

export const OnClickOutside = defineComponent<OnClickOutsideProps>({
name: 'OnClickOutside',
props: ['as'] as unknown as undefined,
props: ['as', 'options'] as unknown as undefined,
emits: ['trigger'],
setup(props, { slots, emit }) {
const target = ref()
onClickOutside(target, (e) => {
emit('trigger', e)
})
}, props.options)

return () => {
if (slots.default)
Expand Down

0 comments on commit 62fadcd

Please sign in to comment.