mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-02-02 05:08:03 +01:00
feat(useOverlay)!: handle programmatic modals and slideovers (#3279)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -5,16 +5,18 @@ const LazyModalExample = defineAsyncComponent(() => import('../../components/Mod
|
||||
|
||||
const open = ref(false)
|
||||
const count = ref(0)
|
||||
const overlay = useOverlay()
|
||||
|
||||
const modal = useModal()
|
||||
const modal = overlay.create(LazyModalExample, {
|
||||
props: {
|
||||
count: count.value
|
||||
}
|
||||
})
|
||||
|
||||
function openModal() {
|
||||
count.value++
|
||||
|
||||
modal.open(LazyModalExample, {
|
||||
description: 'And you can even provide a description!',
|
||||
count: count.value
|
||||
})
|
||||
modal.open({ count: count.value })
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -5,16 +5,18 @@ const LazySlideoverExample = defineAsyncComponent(() => import('../../components
|
||||
|
||||
const open = ref(false)
|
||||
const count = ref(0)
|
||||
const overlay = useOverlay()
|
||||
|
||||
const slideover = useSlideover()
|
||||
const slideover = overlay.create(LazySlideoverExample, {
|
||||
props: {
|
||||
count: count.value
|
||||
}
|
||||
})
|
||||
|
||||
function openSlideover() {
|
||||
count.value++
|
||||
|
||||
slideover.open(LazySlideoverExample, {
|
||||
title: 'Slideover',
|
||||
count: count.value
|
||||
})
|
||||
slideover.open({ count: count.value })
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user