Modal can close + opening modal marks email as read

This commit is contained in:
Jeffrey Biles
2020-03-18 12:55:31 -07:00
parent 270747cd98
commit 050bcfc977
2 changed files with 12 additions and 7 deletions

View File

@@ -4,7 +4,7 @@
<tr v-for="email in emails"
:key="email.id"
:class="[email.read ? 'read' : '']"
@click="openedEmail = email"
@click="openEmail(email)"
class="clickable">
<td>
<input type="checkbox"
@@ -20,7 +20,7 @@
</tbody>
</table>
<MailViewModal :email="openedEmail" />
<MailViewModal :email="openedEmail" :closeModal="() => {openedEmail = null;}"/>
</template>
<script>
@@ -34,7 +34,12 @@
let {emailSelection} = useEmailSelection();
let openedEmail = ref();
return {format, emailSelection, openedEmail}
let openEmail = function(email) {
openedEmail.value = email;
openedEmail.value.read = true;
}
return {format, emailSelection, openedEmail, openEmail}
},
props: {
emails: {

View File

@@ -1,6 +1,6 @@
<template>
<div class="modal" v-if="email">
<div class="overlay"></div>
<div class="overlay" @click="closeModal()"></div>
<div class="modal-card">
From: {{email.from}}<br>
Subject: <strong>{{email.subject}}</strong>
@@ -15,9 +15,9 @@
email: {
type: Object
},
isOpened: {
type: Boolean,
default: true
closeModal: {
type: Function,
required: true
}
}
}