mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-23 15:41:33 +00:00
Store all emails, not just ids, so they can be used elsewhere
This commit is contained in:
@@ -1,13 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<p>Number selected: {{emailSelection.ids.size}}</p>
|
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<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>
|
<td>
|
||||||
<input type="checkbox"
|
<input type="checkbox"
|
||||||
:checked="emailSelection.ids.has(email.id)"
|
:checked="emailSelection.ids.has(email)"
|
||||||
@click="emailSelection.toggle(email.id)" />
|
@click="emailSelection.toggle(email)" />
|
||||||
</td>
|
</td>
|
||||||
<td>{{email.from}}</td>
|
<td>{{email.from}}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ref, reactive } from 'vue';
|
import { ref, reactive } from 'vue';
|
||||||
|
|
||||||
let ids = new Set(['1', '5']);
|
let ids = new Set();
|
||||||
export const useEmailSelection = function(){
|
export const useEmailSelection = function(){
|
||||||
|
|
||||||
let emailSelection = reactive({
|
let emailSelection = reactive({
|
||||||
|
|||||||
Reference in New Issue
Block a user