Chains

The full example, that displays passing data, reusing, and modal chains:

App.vue
<script setup>
import LoginDialog from './LoginDialog.vue'
import InfoModal from './InfoModal.vue'
import { createConfirmDialog } from 'vuejs-confirm-dialog'
import { ref } from 'vue'
const loginDialog = createConfirmDialog(LoginDialog)
const infoModal = createConfirmDialog(InfoModal, { title: 'Some Title' })
const user = ref(null)
const login = async () => {
const result = await infoModal.reveal({ title: 'Please log in to the system' })
if(!result.isCanceled) {
const { data, isCanceled } = await loginDialog.reveal()
if(!isCanceled) {
user.value = data
infoModal.reveal({ title: 'You have successfully logged in.' })
} else {
infoModal.reveal({ title: 'You were unable to log in and will not be able to access your data.' })
}
}
}
</script>