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