Skip to content

Commit

Permalink
perf: added lazy loading to images
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDogHusky committed Oct 2, 2024
1 parent 5909cde commit dabbc39
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ onMounted(() => {
</div>
<div class="d-flex align-items-center justify-content-center flex-wrap flex-column center">
<div class="rounded p-0 border border-3 border-primary image-main-frame">
<img :src="imageUrl" v-if="imageUrl" alt="neko" class="object-fit-contain main-image" @error="$event.target.src='https://http.cat/404'" />
<img :src="imageUrl" loading="lazy" v-if="imageUrl" alt="neko" class="object-fit-contain main-image" @error="$event.target.src='https://http.cat/404'" />
</div>
<div class="btn-toolbar justify-content-center gap-2 mt-2" role="group">
<button @click="fetchImage" role="button" class="btn btn-primary" :disabled="isLoading">New one!</button>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/random/[type].vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ onMounted(() => {
</div>
<div class="row">
<div class="d-flex justify-content-center">
<img class="img-fluid mt-3 mx-auto" v-if="imageUrl" @error="$event.target.src='https://http.cat/404'" :alt="$route.params.type" :src="imageUrl">
<img class="img-fluid mt-3 mx-auto" loading="lazy" v-if="imageUrl" @error="$event.target.src='https://http.cat/404'" :alt="$route.params.type" :src="imageUrl">
</div>
</div>
</main>
Expand Down

0 comments on commit dabbc39

Please sign in to comment.