mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-23 15:41:33 +00:00
rename addToSelectedEmail to toggleEmailSelection
This commit is contained in:
@@ -6,9 +6,11 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="email in emails" :key="email.id" :class="[email.read ? 'read' : '']">
|
<tr v-for="email in emails" :key="email.id" :class="[email.read ? 'read' : '']">
|
||||||
<td><input type="checkbox"
|
<td>
|
||||||
:checked="selectedEmailIds.has(email.id)"
|
<input type="checkbox"
|
||||||
@click="addToSelectedEmails(email.id)" /></td>
|
:checked="selectedEmailIds.has(email.id)"
|
||||||
|
@click="toggleEmailSelection(email.id)" />
|
||||||
|
</td>
|
||||||
<td>{{email.from}}</td>
|
<td>{{email.from}}</td>
|
||||||
<td>
|
<td>
|
||||||
<p><strong>{{email.subject}}</strong> - {{email.body}}</p>
|
<p><strong>{{email.subject}}</strong> - {{email.body}}</p>
|
||||||
@@ -25,14 +27,14 @@
|
|||||||
export default {
|
export default {
|
||||||
setup(){
|
setup(){
|
||||||
let selectedEmailIds = ref(new Set(['1', '5']))
|
let selectedEmailIds = ref(new Set(['1', '5']))
|
||||||
let addToSelectedEmails = (id) => {
|
let toggleEmailSelection = (id) => {
|
||||||
if(selectedEmailIds.value.has(id)) {
|
if(selectedEmailIds.value.has(id)) {
|
||||||
selectedEmailIds.value.delete(id)
|
selectedEmailIds.value.delete(id)
|
||||||
} else {
|
} else {
|
||||||
selectedEmailIds.value.add(id);
|
selectedEmailIds.value.add(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {format, selectedEmailIds, addToSelectedEmails}
|
return {format, selectedEmailIds, toggleEmailSelection}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
emails: {
|
emails: {
|
||||||
|
|||||||
Reference in New Issue
Block a user