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

View File

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