1
0

feat: type defineEmits for CreateEdit

This commit is contained in:
Dominik Pschenitschni 2024-07-06 13:04:28 +02:00 committed by konrad
parent c9591fe464
commit 098c99fd2e

View File

@ -22,7 +22,7 @@
v-if="tertiary !== ''" v-if="tertiary !== ''"
:shadow="false" :shadow="false"
variant="tertiary" variant="tertiary"
@click.prevent.stop="$emit('tertiary')" @click.prevent.stop="$emit('tertiary', $event)"
> >
{{ tertiary }} {{ tertiary }}
</x-button> </x-button>
@ -38,7 +38,7 @@
:icon="primaryIcon" :icon="primaryIcon"
:disabled="primaryDisabled || loading" :disabled="primaryDisabled || loading"
class="ml-2" class="ml-2"
@click.prevent.stop="primary()" @click.prevent.stop="primary"
> >
{{ primaryLabel || $t('misc.create') }} {{ primaryLabel || $t('misc.create') }}
</x-button> </x-button>
@ -70,10 +70,14 @@ withDefaults(defineProps<{
loading: false, loading: false,
}) })
const emit = defineEmits(['create', 'primary', 'tertiary']) const emit = defineEmits<{
'create': [event: MouseEvent],
'primary': [event: MouseEvent],
'tertiary': [event: MouseEvent]
}>()
function primary() { function primary(event: MouseEvent) {
emit('create') emit('create', event)
emit('primary') emit('primary', event)
} }
</script> </script>