mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-24 07:55:34 +00:00
MAke the changeEmail function work in setup hook
This commit is contained in:
@@ -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: {
|
||||||
|
|||||||
Reference in New Issue
Block a user