MAke the changeEmail function work in setup hook

This commit is contained in:
Jeffrey Biles
2020-03-19 03:32:05 -07:00
parent a495f6141c
commit 327e9b5835

View File

@@ -21,7 +21,7 @@
<portal target="#modal-portal"> <portal target="#modal-portal">
<ModalView v-if="!!openedEmail" :closeModal="() => {openedEmail = null;}"> <ModalView v-if="!!openedEmail" :closeModal="() => {openedEmail = null;}">
<MailView :email="openedEmail" @changeEmail="changeEmail" /> <MailView :email="openedEmail" @changeEmail="(args) => changeEmail(emails, args)" />
</ModalView> </ModalView>
</portal> </portal>
</table> </table>
@@ -47,16 +47,15 @@
} }
} }
return {format, emailSelection, openedEmail, openEmail} function changeEmail(emails, {amount, archive}){
}, let index = emails.findIndex(e => e == openedEmail.value);
methods: {
changeEmail({amount, archive}) {
let index = this.emails.findIndex(e => e == this.openedEmail);
if(archive) { this.emails[index].archived = true } if(archive) { emails[index].archived = true }
this.openEmail(this.emails[index + amount]) openEmail(emails[index + amount])
} }
return {format, emailSelection, openedEmail, openEmail, changeEmail}
}, },
props: { props: {
emails: { emails: {