wf4/components/Button.vue
webfussel c82262e02d CHANGE: remove withDefaults
Remove with defaults as it is no longer needed
2025-01-29 09:21:57 +01:00

27 lines
456 B
Vue

<template>
<component :is="type" v-bind="actualProps()" class="Button">
{{ label }}
</component>
</template>
<script setup lang="ts">
type Props = {
type ?: 'a' | 'button'
href ?: string
label : string
}
const {
type = 'a'
} = defineProps<Props>()
const actualProps = () => {
if (props.type === 'a') {
return {
href: props.href,
target: props.href!.startsWith('https://') ? '_blank' : undefined,
}
}
}
</script>