Video 6 - Modal

This commit is contained in:
Jeffrey Biles
2020-06-18 12:36:07 -07:00
parent 128c2a2335
commit cab244c0b0
2 changed files with 28 additions and 2 deletions

View File

@@ -17,13 +17,16 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<MailView v-if="openedEmail" :email="openedEmail" /> <ModalView v-if="openedEmail" @closeModal="openedEmail = null">
<MailView :email="openedEmail" />
</ModalView>
</template> </template>
<script> <script>
import { format } from 'date-fns'; import { format } from 'date-fns';
import axios from 'axios'; import axios from 'axios';
import MailView from '@/components/MailView.vue'; import MailView from '@/components/MailView.vue';
import ModalView from '@/components/ModalView.vue';
export default { export default {
async setup(){ async setup(){
@@ -35,7 +38,8 @@
} }
}, },
components: { components: {
MailView MailView,
ModalView
}, },
computed: { computed: {
sortedEmails() { sortedEmails() {

View File

@@ -0,0 +1,22 @@
<template>
<div class="modal">
<div class="overlay" @click="emit('closeModal')"></div>
<div class="modal-card">
<slot />
</div>
</div>
</template>
<script>
export default {
setup(props, {emit}) {
return {
emit
}
}
}
</script>
<style scoped>
</style>