Bugfix: using props in the setup function only works properly if you _don't_ destructure them

This commit is contained in:
Jeffrey Biles
2020-04-22 21:12:41 -07:00
parent ec200fd57a
commit e7107d1bfe

View File

@@ -35,14 +35,14 @@
import { computed } from 'vue'; import { computed } from 'vue';
export default { export default {
setup({emails}){ setup(props){
let emailSelection = useEmailSelection(); let emailSelection = useEmailSelection();
let numberSelected = computed(() => { let numberSelected = computed(() => {
return emailSelection.emails.size; return emailSelection.emails.size;
}) })
let allAreSelected = computed(() => { let allAreSelected = computed(() => {
return emails.length == numberSelected.value; return props.emails.length == numberSelected.value;
}) })
let partialSelection = computed(() => { let partialSelection = computed(() => {
return numberSelected.value > 0 && !allAreSelected.value; return numberSelected.value > 0 && !allAreSelected.value;
@@ -52,7 +52,7 @@
if(allAreSelected.value) { if(allAreSelected.value) {
emailSelection.clear(); emailSelection.clear();
} else { } else {
emailSelection.addMultiple(emails) emailSelection.addMultiple(props.emails)
} }
} }