mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-11 18:54:31 +00:00
BulkActionBar
This commit is contained in:
26
src/components/BulkActionBar.vue
Normal file
26
src/components/BulkActionBar.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<div class="bulk-action-bar">
|
||||
<button @click="emailSelection.markRead()">
|
||||
Mark Read
|
||||
</button>
|
||||
<button @click="emailSelection.markUnread()">
|
||||
Mark Unread
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import useEmailSelection from '../composition/useEmailSelection';
|
||||
|
||||
export default {
|
||||
setup(){
|
||||
let {emailSelection} = useEmailSelection();
|
||||
return { emailSelection }
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,28 +1,25 @@
|
||||
<template>
|
||||
<h1>VMail Inbox</h1>
|
||||
|
||||
<p>Number selected: {{emailSelection.emails.size}}</p>
|
||||
<button @click="emailSelection.markRead()">Mark Selected Read</button>
|
||||
<button @click="emailSelection.markUnread()">Mark Selected Unread</button>
|
||||
<BulkActionBar />
|
||||
|
||||
<MailTable :emails="emails" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MailTable from '@/components/MailTable.vue';
|
||||
import useEmailSelection from '../composition/useEmailSelection';
|
||||
import BulkActionBar from '@/components/BulkActionBar.vue';
|
||||
|
||||
export default {
|
||||
async setup(props, {attrs, slots}){
|
||||
let response = await fetch('/api/emails');
|
||||
let {emails} = await response.json();
|
||||
|
||||
let {emailSelection} = useEmailSelection();
|
||||
|
||||
return {emails, emailSelection}
|
||||
return {emails}
|
||||
},
|
||||
components: {
|
||||
MailTable
|
||||
MailTable,
|
||||
BulkActionBar
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user