1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-19 15:29:59 +00:00
elk/components/common/dropdown/Dropdown.vue

32 lines
652 B
Vue
Raw Normal View History

2022-11-24 08:34:05 +00:00
<script setup lang="ts">
2023-01-03 11:58:08 +00:00
import { InjectionKeyDropdownContext } from '~/constants/symbols'
defineProps<{
placement?: string
autoBoundaryMaxSize?: boolean
}>()
2022-11-24 08:34:05 +00:00
const dropdown = $ref<any>()
const colorMode = useColorMode()
2022-11-24 08:34:05 +00:00
function hide() {
return dropdown.hide()
}
2023-01-03 11:58:08 +00:00
provide(InjectionKeyDropdownContext, {
hide,
})
defineExpose({
hide,
2022-11-24 08:34:05 +00:00
})
</script>
<template>
<VDropdown v-bind="$attrs" ref="dropdown" :class="colorMode.value" :placement="placement || 'auto'" :auto-boundary-max-size="autoBoundaryMaxSize">
2022-11-24 08:34:05 +00:00
<slot />
<template #popper="scope">
<slot name="popper" v-bind="scope" />
</template>
</VDropdown>
</template>