I've recently started diving into vue.js and I'm honing my skills with vuetify. I've been grappling with this layout for quite some time now but I seem to be stuck. Could someone please guide me through approaching this problem?
I have an array of objects that contains descriptions and images which I aim to display in a specific format as shown in the image below.https://i.sstatic.net/ecrn7.png
The logic behind the layout is as follows - the first card should display a description, the second one, an image. When transitioning to a new row, like the second row, the image should persist just like in the fourth card. The pattern continues with alternating text and image cards starting from the eighth and ninth positions.
<template>
<div class="home">
<v-container grid-list-lg>
<h1>Home</h1>
<v-layout row>
<v-flex lg3 v-for="(item, index) in arr" :key="item.id" class="space-bottom">
<v-card class="mx-auto" max-width="344" outlined>
<v-list-item three-line>
<v-list-item-content v-if="index % 2 === 0" height="400px">
<v-list-item-subtitle>{{item.description}}</v-list-item-subtitle>
<v-list-item-subtitle class="subtitle-style">
<span>
<a href="#">Read more</a>
</span>
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-hover>
<template v-slot:default="{ hover }">
<v-list-item-content v-if="index % 2 !== 0">
<img :src="item.imageUrl" />
<v-fade-transition>
<v-overlay v-if="hover" absolute color="#036358">
<v-btn>See more info</v-btn>
</v-overlay>
</v-fade-transition>
</v-list-item-content>
</template>
</v-hover>
</v-card>
</v-flex>
</v-layout>
</v-container>
</div>
</template>
<script>
export default {
props: {},
data() {
return {
arr: [ {description: "description 1", imageUrl: "https://via.placeholder.com/100"},
{description: "description 2", imageUrl: "https://via.placeholder.com/100"},
{description: "description 3", imageUrl: "https://via.placeholder.com/100"},
{description: "description 4", imageUrl: "https://via.placeholder.com/100"},
{description: "description 1", imageUrl: "https://via.placeholder.com/100"},
{description: "description 1", imageUrl: "https://via.placeholder.com/100"},
{description: "description 1", imageUrl: "https://via.placeholder.com/100"},
{description: "description 2", imageUrl: "https://via.placeholder.com/100"},
{description: "description 3", imageUrl: "https://via.placeholder.com/100"},
{description: "description 4", imageUrl: "https://via.placeholder.com/100"},
{description: "description 1", imageUrl: "https://via.placeholder.com/100"},
{description: "description 1", imageUrl: "https://via.placeholder.com/100"}]
};
}
};
</script>
<style>
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
Currently, the layout looks like this: https://i.sstatic.net/UCOjx.png