feat: zoom image home
gitea/hedera-web/pipeline/pr-beta This commit looks good Details

This commit is contained in:
Javier Segarra 2025-01-16 13:29:00 +01:00
parent 2392f8c8d7
commit 3eb191d2d1
1 changed files with 18 additions and 3 deletions

View File

@ -1,6 +1,5 @@
<script setup> <script setup>
import { ref, onMounted, inject } from 'vue'; import { ref, onMounted, inject } from 'vue';
import VnImg from 'src/components/ui/VnImg.vue';
const jApi = inject('jApi'); const jApi = inject('jApi');
const news = ref([]); const news = ref([]);
const showPreview = ref(false); const showPreview = ref(false);
@ -14,6 +13,15 @@ const fetchData = async () => {
); );
}; };
const showImagePreview = src => {
showPreview.value = true;
selectedImageSrc.value = src;
};
const hideImagePreview = src => {
showPreview.value = false;
selectedImageSrc.value = null;
};
onMounted(async () => await fetchData()); onMounted(async () => await fetchData());
</script> </script>
@ -22,7 +30,14 @@ onMounted(async () => await fetchData());
<div class="q-pa-sm row items-start"> <div class="q-pa-sm row items-start">
<div class="new-card q-pa-sm" v-for="myNew in news" :key="myNew.id"> <div class="new-card q-pa-sm" v-for="myNew in news" :key="myNew.id">
<QCard> <QCard>
<VnImg :id="myNew.image" storage="news" /> <QImg
:src="`${$app.imageUrl}/news/full/${myNew.image}`"
@click="
showImagePreview(
`${$app.imageUrl}/news/full/${myNew.image}`
)
"
/>
<QCardSection> <QCardSection>
<div class="text-h5"> <div class="text-h5">
@ -46,7 +61,7 @@ onMounted(async () => await fetchData());
> >
</QPageSticky> </QPageSticky>
</div> </div>
<QDialog v-model="showPreview" @hide="selectedImageSrc = ''"> <QDialog v-model="showPreview" @hide="hideImagePreview">
<QImg :src="selectedImageSrc" /> <QImg :src="selectedImageSrc" />
</QDialog> </QDialog>
</template> </template>