mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-18 21:45:09 +00:00
Can switch between inbox and archived mail screens and keep changes in archived videos
This commit is contained in:
36
src/components/MailScreen.vue
Normal file
36
src/components/MailScreen.vue
Normal file
@@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<div>
|
||||
<component :is="screenName" :emails="emails" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MailScreenArchived from '@/components/MailScreenArchived.vue';
|
||||
import MailScreenInbox from '@/components/MailScreenInbox.vue';
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default {
|
||||
async setup(){
|
||||
let response = await fetch('/api/emails');
|
||||
let {emails} = await response.json();
|
||||
|
||||
emails = ref(emails);
|
||||
|
||||
return {emails};
|
||||
},
|
||||
components: {
|
||||
MailScreenArchived,
|
||||
MailScreenInbox
|
||||
},
|
||||
props: {
|
||||
screenName: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -10,16 +10,12 @@
|
||||
import MailTable from '@/components/MailTable.vue';
|
||||
import BulkActionBar from '@/components/BulkActionBar.vue';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
|
||||
export default {
|
||||
async setup(){
|
||||
let response = await fetch('/api/emails');
|
||||
let {emails} = await response.json();
|
||||
|
||||
emails = ref(emails);
|
||||
async setup({emails}){
|
||||
let archivedEmails = computed(() => {
|
||||
return emails.value.filter(e => e.archived)
|
||||
return emails.filter(e => e.archived)
|
||||
})
|
||||
|
||||
return {archivedEmails}
|
||||
@@ -10,16 +10,12 @@
|
||||
import MailTable from '@/components/MailTable.vue';
|
||||
import BulkActionBar from '@/components/BulkActionBar.vue';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed } from 'vue';
|
||||
|
||||
export default {
|
||||
async setup(){
|
||||
let response = await fetch('/api/emails');
|
||||
let {emails} = await response.json();
|
||||
|
||||
emails = ref(emails);
|
||||
async setup({emails}){
|
||||
let inboxEmails = computed(() => {
|
||||
return emails.value.filter(e => !e.archived)
|
||||
return emails.filter(e => !e.archived)
|
||||
})
|
||||
|
||||
return {inboxEmails}
|
||||
Reference in New Issue
Block a user