From 327e9b58352220c492cc7c755ae68815a976e373 Mon Sep 17 00:00:00 2001 From: Jeffrey Biles Date: Thu, 19 Mar 2020 03:32:05 -0700 Subject: [PATCH] MAke the changeEmail function work in setup hook --- src/components/MailTable.vue | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/MailTable.vue b/src/components/MailTable.vue index 3515e2a..cce0d48 100644 --- a/src/components/MailTable.vue +++ b/src/components/MailTable.vue @@ -21,7 +21,7 @@ - + @@ -47,16 +47,15 @@ } } - return {format, emailSelection, openedEmail, openEmail} - }, - methods: { - changeEmail({amount, archive}) { - let index = this.emails.findIndex(e => e == this.openedEmail); + function changeEmail(emails, {amount, archive}){ + let index = emails.findIndex(e => e == openedEmail.value); - 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: { emails: {