feat(Modal): open programmatically (#1319)

This commit is contained in:
Neil Richter
2024-02-07 16:53:17 +01:00
committed by GitHub
parent 98a2d0f1af
commit 6f29c620ab
11 changed files with 168 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
<script lang="ts" setup>
defineProps({
count: {
type: Number,
default: 0
}
})
</script>
<template>
<UModal>
<UCard>
<p>This modal was opened programmatically !</p>
<p>Count: {{ count }}</p>
</UCard>
</UModal>
</template>

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import { ModalExampleComponent } from '#components'
const modal = useModal()
const count = ref(0)
function openModal () {
count.value += 1
modal.open(ModalExampleComponent, {
count: count.value
})
}
</script>
<template>
<UButton label="Reveal modal" @click="openModal" />
</template>