mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-11 18:54:31 +00:00
clicking the Select All box
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
<div>
|
||||
<input type="checkbox"
|
||||
:checked="allAreSelected"
|
||||
:class="[partialSelection ? 'partial-check' : '']">
|
||||
:class="[partialSelection ? 'partial-check' : '']"
|
||||
@click="bulkSelect">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -24,9 +25,18 @@
|
||||
return numberSelected.value > 0 && !allAreSelected.value;
|
||||
})
|
||||
|
||||
let bulkSelect = function(){
|
||||
if(allAreSelected.value) {
|
||||
emailSelection.clear();
|
||||
} else {
|
||||
emailSelection.addMultiple(emails)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
partialSelection,
|
||||
allAreSelected
|
||||
allAreSelected,
|
||||
bulkSelect
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
||||
@@ -11,6 +11,14 @@ export const useEmailSelection = function(){
|
||||
this.emails.add(id);
|
||||
}
|
||||
},
|
||||
clear(){
|
||||
this.emails.clear();
|
||||
},
|
||||
addMultiple(emails) {
|
||||
emails.forEach(email => {
|
||||
this.emails.add(email)
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
return { emailSelection }
|
||||
|
||||
Reference in New Issue
Block a user