Skip to content

Commit

Permalink
Improve slideover example
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoRCD committed Jan 17, 2025
1 parent 0945a18 commit 01083bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ const slideover = useSlideover()
defineProps<{
count: number
}>()
const emit = defineEmits(['success'])
function onSuccess() {
emit('success')
}
</script>

<template>
Expand All @@ -13,7 +19,10 @@ defineProps<{
</template>

<template #footer>
<UButton color="neutral" label="Close" @click="slideover.close()" />
<div class="flex gap-2">
<UButton color="neutral" label="Close" @click="slideover.close()" />
<UButton label="Success" @click="onSuccess" />
</div>
</template>
</USlideover>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ import { LazySlideoverExample } from '#components'
const count = ref(0)
const toast = useToast()
const slideover = useSlideover()
function open() {
count.value++
slideover.open(LazySlideoverExample, {
title: 'Slideover',
count: count.value
count: count.value,
onSuccess() {
toast.add({
title: 'Success !',
id: 'modal-success'
})
}
})
}
</script>
Expand Down

0 comments on commit 01083bb

Please sign in to comment.