Skip to content

Commit

Permalink
3е занятие - правки по 4й задаче
Browse files Browse the repository at this point in the history
  • Loading branch information
Vombat committed Dec 24, 2024
1 parent 7c162c6 commit 64c33a6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions 02-basics-2/40-marked-emails/MarkedEmailsApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export default defineComponent({
const search = ref('');

const filteredEmails = computed(() => {
if (!search.value) return []
return emails.filter(item => item.toLowerCase().includes(search.value.toLowerCase()))
const arr = [];
emails.forEach(email => arr.push({emailValue: email, isFlagged: search.value && email.toLowerCase().includes(search.value.toLowerCase())}));
return arr;
})

return {
search,
emails,
filteredEmails
}
},
Expand All @@ -54,11 +54,11 @@ export default defineComponent({
</div>
<ul aria-label="Emails">
<li
v-for="(email, index) in emails"
v-for="(email, index) in filteredEmails"
:key="index"
:class="{'marked': filteredEmails.includes(email)}"
:class="{'marked': email.isFlagged}"
>
{{ email }}
{{ email.emailValue }}
</li>
</ul>
</div>
Expand Down

0 comments on commit 64c33a6

Please sign in to comment.