<div v-else class="app-content">
<div class="items">
<div
v-for="(dog, idx) in allDogs"
:key="idx"
class="card"
>
<img :src="dog.url" alt="alt">
<div class="card__name">{{dog.breeds[0].name}}</div>
</div>
</div>
</div>
<input type="checkbox" v-model="sort">
<div v-for="dog in sortedDogs">
data: () => ({
sort: false,
}),
computed: {
sortedDogs() {
return this.sort
? [...this.allDogs].sort((a, b) => a.breeds[0].name.localeCompare(b.breeds[0].name))
: this.allDogs;
},
},