Store all emails, not just ids, so they can be used elsewhere

This commit is contained in:
Jeffrey Biles
2020-03-17 22:47:13 -07:00
parent 48505b6002
commit 90c82a5267
2 changed files with 3 additions and 5 deletions

View File

@@ -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>

View File

@@ -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({