mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-23 23:51:25 +00:00
Use the Options API for two components
This commit is contained in:
@@ -10,19 +10,21 @@
|
|||||||
import MailTable from '@/components/MailTable.vue';
|
import MailTable from '@/components/MailTable.vue';
|
||||||
import BulkActionBar from '@/components/BulkActionBar.vue';
|
import BulkActionBar from '@/components/BulkActionBar.vue';
|
||||||
|
|
||||||
import { computed } from 'vue';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
async setup({emails}){
|
|
||||||
let archivedEmails = computed(() => {
|
|
||||||
return emails.filter(e => e.archived)
|
|
||||||
})
|
|
||||||
|
|
||||||
return {archivedEmails}
|
|
||||||
},
|
|
||||||
components: {
|
components: {
|
||||||
MailTable,
|
MailTable,
|
||||||
BulkActionBar
|
BulkActionBar
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
archivedEmails(){
|
||||||
|
return this.emails.filter(e => e.archived)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
emails: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -10,19 +10,21 @@
|
|||||||
import MailTable from '@/components/MailTable.vue';
|
import MailTable from '@/components/MailTable.vue';
|
||||||
import BulkActionBar from '@/components/BulkActionBar.vue';
|
import BulkActionBar from '@/components/BulkActionBar.vue';
|
||||||
|
|
||||||
import { computed } from 'vue';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
async setup({emails}){
|
|
||||||
let inboxEmails = computed(() => {
|
|
||||||
return emails.filter(e => !e.archived)
|
|
||||||
})
|
|
||||||
|
|
||||||
return {inboxEmails}
|
|
||||||
},
|
|
||||||
components: {
|
components: {
|
||||||
MailTable,
|
MailTable,
|
||||||
BulkActionBar
|
BulkActionBar
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
inboxEmails(){
|
||||||
|
return this.emails.filter(e => !e.archived)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
emails: {
|
||||||
|
type: Object,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user