mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-22 15:15:34 +00:00
Archive filtering and bulk action button
This commit is contained in:
@@ -21,6 +21,9 @@ new Server({
|
|||||||
},
|
},
|
||||||
sentDate(){
|
sentDate(){
|
||||||
return faker.date.recent(20)
|
return faker.date.recent(20)
|
||||||
|
},
|
||||||
|
archived(i){
|
||||||
|
return i % 2 == 0;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
<button @click="emailSelection.markUnread()" :disabled="Array.from(emailSelection.emails).every(e => !e.read)">
|
<button @click="emailSelection.markUnread()" :disabled="Array.from(emailSelection.emails).every(e => !e.read)">
|
||||||
Mark Unread
|
Mark Unread
|
||||||
</button>
|
</button>
|
||||||
|
<button @click="emailSelection.archive()" :disabled="numberSelected == 0">
|
||||||
|
Archive
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<BulkActionBar :emails="emails" />
|
<BulkActionBar :emails="emails" />
|
||||||
|
|
||||||
<MailTable :emails="emails" />
|
<MailTable :emails="emails.filter(e => !e.archived)" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export const useEmailSelection = function(){
|
|||||||
},
|
},
|
||||||
markRead(){ this.forSelected(e => e.read = true )},
|
markRead(){ this.forSelected(e => e.read = true )},
|
||||||
markUnread(){ this.forSelected(e => e.read = false )},
|
markUnread(){ this.forSelected(e => e.read = false )},
|
||||||
|
archive(){ this.forSelected(e => e.archived = true); this.clear();},
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user