feat: add withDefaults, defineEmits and defineSlots types for Dropdown
This commit is contained in:
parent
043a6dd049
commit
5545b0e447
@ -36,20 +36,31 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, type PropType} from 'vue'
|
import {ref} from 'vue'
|
||||||
import {onClickOutside} from '@vueuse/core'
|
import {onClickOutside} from '@vueuse/core'
|
||||||
import type {IconProp} from '@fortawesome/fontawesome-svg-core'
|
import type {IconProp} from '@fortawesome/fontawesome-svg-core'
|
||||||
|
|
||||||
import CustomTransition from '@/components/misc/CustomTransition.vue'
|
import CustomTransition from '@/components/misc/CustomTransition.vue'
|
||||||
import BaseButton from '@/components/base/BaseButton.vue'
|
import BaseButton from '@/components/base/BaseButton.vue'
|
||||||
|
|
||||||
defineProps({
|
withDefaults(defineProps<{
|
||||||
triggerIcon: {
|
triggerIcon?: IconProp
|
||||||
type: String as PropType<IconProp>,
|
}>(), {
|
||||||
default: 'ellipsis-h',
|
triggerIcon: 'ellipsis-h',
|
||||||
},
|
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['close'])
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'close': [event: PointerEvent]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
defineSlots<{
|
||||||
|
'trigger': (props: {
|
||||||
|
close: () => void,
|
||||||
|
toggleOpen: () => void,
|
||||||
|
open: boolean
|
||||||
|
}) => void,
|
||||||
|
'default': () => void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
|
||||||
const initialMount = ref(false)
|
const initialMount = ref(false)
|
||||||
@ -64,7 +75,7 @@ function toggleOpen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dropdown = ref()
|
const dropdown = ref()
|
||||||
onClickOutside(dropdown, (e: Event) => {
|
onClickOutside(dropdown, (e) => {
|
||||||
if (!open.value) {
|
if (!open.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user