Nuxt/examples/app/teleport/components/MyModal.vue
Daniel Roe fdd38f958c
feat(nitro): support for rendering ssr teleports to body (#3909)
Co-authored-by: pooya parsa <pyapar@gmail.com>
2022-04-01 16:06:48 +02:00

35 lines
506 B
Vue

<script>
export default {
data () {
return {
open: false
}
}
}
</script>
<template>
<NButton @click="open = true">
Open Modal
</NButton>
<Teleport to="body">
<NCard v-if="open" class="modal p4">
<p>Hello from the modal!</p>
<NButton @click="open = false">
Close
</NButton>
</NCard>
</Teleport>
</template>
<style scoped>
.modal {
position: fixed;
z-index: 999;
top: 20%;
left: 50%;
width: 300px;
margin-left: -150px;
}
</style>