Skip to content

Commit

Permalink
fix(docs): Avoid image size decrease
Browse files Browse the repository at this point in the history
close #666
  • Loading branch information
rldorado committed Dec 1, 2023
1 parent 7c4d2d8 commit fa815c4
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions components/content/ProseImg.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
<template>
<span class="text-center d-block">
<NuxtImg :src="refinedSrc" :alt="alt" :width="width" :height="height" :class="classWithZoom" loading="lazy" format="webp" quality="80" densities="x1 x2" />
<NuxtImg
:src="refinedSrc"
:alt="alt"
:width="width"
:height="height"
:class="classWithZoom"
loading="lazy"
format="webp"
quality="80"
densities="x1 x2"
/>
</span>
</template>

<script setup lang="ts">
import { withBase } from 'ufo'
import { useRuntimeConfig, computed } from '#imports'
const props = defineProps({
src: {
type: String,
Expand All @@ -29,6 +40,7 @@
default: ''
}
})
const refinedSrc = computed(() => {
if (props.src?.startsWith('/') && !props.src.startsWith('//')) {
return withBase(props.src, useRuntimeConfig().app.baseURL)
Expand All @@ -39,4 +51,10 @@
const classWithZoom = computed(() => {
return "zoom " + props.class
})
</script>
</script>

<style lang="scss" scoped>
.bd-content img {
width: 100%;
}
</style>

0 comments on commit fa815c4

Please sign in to comment.