Skip to content

Commit

Permalink
Merge pull request #7 from luquii2/master
Browse files Browse the repository at this point in the history
Отмеченные Email-ы
  • Loading branch information
jsru-1 authored Dec 24, 2024
2 parents be998a1 + 43ff204 commit 18f58ab
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions 02-basics-2/40-marked-emails/MarkedEmailsApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,39 @@ export const emails = [
export default defineComponent({
name: 'MarkedEmailsApp',

setup() {},
setup() {
const search = ref(null)
const email = ref(emails)

const emailMarked = computed(() => {
return email.value.map((mail) => {
if (mail.indexOf(search.value) !== -1 && search.value !== "") {
return {
mail: mail,
marked: true,
}
}
return {
mail: mail
}
})
})

return {
search,
emailMarked,
email
}
},

template: `
<div>
<div class="form-group">
<input type="search" aria-label="Search" />
<input v-model="search" type="search" aria-label="Search" />
</div>
<ul aria-label="Emails">
<li>
[email protected]
</li>
<li class="marked">
[email protected]
<li :class="{'marked': mail.marked}" v-for="mail in emailMarked" >
{{ mail.mail }}
</li>
</ul>
</div>
Expand Down

0 comments on commit 18f58ab

Please sign in to comment.