Fix another component's events

This commit is contained in:
Ramon Wenger 2023-04-19 17:09:20 +02:00
parent c3fccd6cce
commit 8cbe498a78
1 changed files with 31 additions and 24 deletions

View File

@ -1,8 +1,12 @@
<template> <template>
<button <button
:class="['button', 'button-with-icon-and-text', { 'button-with-icon-and-text--large': large }]" :class="[
'button',
'button-with-icon-and-text',
{'button-with-icon-and-text--large': large},
]"
:disabled="disabled" :disabled="disabled"
@click="$emit('click')" @click="click"
> >
<component <component
class="button-with-icon-and-text__icon" class="button-with-icon-and-text__icon"
@ -12,33 +16,36 @@
</button> </button>
</template> </template>
<script> <script setup lang="ts">
import formElementIcons from '@/components/ui/form-element-icons'; interface Props {
icon: string
text: string
large: boolean
disabled: boolean
}
withDefaults(defineProps<Props>(), {
icon: '',
text: '',
large: false,
disabled: false,
})
const emit = defineEmits(['click'])
const click = () => {
emit('click')
}
</script>
<script lang="ts">
import formElementIcons from '@/components/ui/form-element-icons'
export default { export default {
props: {
icon: {
type: String,
default: '',
},
text: {
type: String,
default: '',
},
large: {
type: Boolean,
default: false,
},
disabled: {
type: Boolean,
default: false,
},
},
components: { components: {
...formElementIcons, ...formElementIcons,
}, },
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">