From 66d86137d7618982961dc6bf71f4692b0b7a8ae8 Mon Sep 17 00:00:00 2001 From: Felipe Yslaoker Date: Wed, 13 Nov 2024 11:10:54 -0300 Subject: [PATCH] updated: url flow --- components/Ly/FilledButton.vue | 18 +++++++++++++++++- pages/index.vue | 9 ++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/components/Ly/FilledButton.vue b/components/Ly/FilledButton.vue index 77fb93f..57c0d00 100644 --- a/components/Ly/FilledButton.vue +++ b/components/Ly/FilledButton.vue @@ -5,20 +5,27 @@ const props = withDefaults( defineProps<{ disabled?: boolean | undefined; loading?: boolean | undefined; + url?: string; }>(), { theme: undefined, disabled: false, loading: false, + url: undefined, }, ); +const { openUrl } = useOpenUrl(); const emit = defineEmits(['click']); -function onClick() { +function onClick(event: MouseEvent) { if (!props.disabled && !props.loading) { emit('click'); } + if (props.url) { + event.preventDefault(); + openUrl(props.url); + } } const isFocused = ref(false); @@ -33,7 +40,12 @@ function handleBlur() {