Лайк на главной странице

This commit is contained in:
iriska-gri committed 2023-12-06 15:08:30 +03:00
1 parent 9ace665e0e
commit 480863117b
2 files changed
+59 -23

No files matched your search

+58 -23
View File
@@ -274,14 +274,40 @@
min-width="200" min-width="200"
height="250" height="250"
> >
<v-card-text class="flex-grow-1 pa-0 d-flex flex-column">
<v-row class=" ma-0 flex-grow-0 ">
<v-col class="d-flex flex-column pa-0">
<v-img <v-img
class="w-100 h-100 pointer" class="w-100 h-100 pointer"
:src="`${burl}${n.img}`" :src="`${burl}${n.img}`"
@click="openImg(n.id)" @click="openImg(n.id)"
/> />
</v-col>
</v-row>
<v-row class=" ma-0 flex-grow-0 align-self-center">
<v-col class="pa-0 flex-grow-0">
<v-card-text class="pt-6"> <v-btn
<!-- <div class="font-weight-light text-grey text-h6 mb-2"> density="compact"
variant="text"
size="small"
:color="heartIcoAll(n)?'red':'black'"
:icon= "heartIcoAll(n)?'mdi-heart':'mdi-heart-outline'"
@click = toggleLikeAll(n.id)
/>
</v-col>
<v-col class="pa-0 pt-0 pl-1">
{{n.likes.length}}
</v-col>
</v-row>
<!-- <v-img
class="w-100 h-100 pointer"
:src="`${burl}${n.img}`"
@click="openImg(n.id)"
/>
<div class="font-weight-light text-grey">
For the perfect meal For the perfect meal
</div> --> </div> -->
@@ -290,6 +316,21 @@
</v-card-text> </v-card-text>
</v-card> </v-card>
<!-- <v-row class="flex-grow-1 align-self-center d-flex placeIt">
<v-col class="pa-0">
<v-btn
density="compact"
variant="text"
:color="heartIco()?'red':'black'"
:icon= "heartIco()?'mdi-heart':'mdi-heart-outline'"
@click = toggleLike(n.id)
/>
</v-col>
<v-col class="pa-0 text-overline">
{{n.likes.length}}
</v-col>
</v-row> -->
</v-col> </v-col>
@@ -482,9 +523,8 @@
</v-row> </v-row>
</v-col> </v-col>
</v-row> </v-row>
<v-row class="flex-grow-0 mt-4 align-self-center"> <v-row class="flex-grow-1 align-self-center d-flex placeIt">
<v-col class="pa-0">
<v-col class="pa-0 flex-grow-0 d-flex">
<v-btn <v-btn
density="compact" density="compact"
variant="text" variant="text"
@@ -492,17 +532,10 @@
:icon= "heartIco()?'mdi-heart':'mdi-heart-outline'" :icon= "heartIco()?'mdi-heart':'mdi-heart-outline'"
@click = toggleLike(galleryimges.id) @click = toggleLike(galleryimges.id)
/> />
<!-- :color="heart?'red':'black'"
:icon="heart?'mdi-heart':'mdi-heart-outline'" -->
</v-col> </v-col>
<v-col class="pa-0 flex-grow-0 text-overline"> <v-col class="pa-0 text-overline">
{{galleryimges.likes.length}} {{galleryimges.likes.length}}
</v-col> </v-col>
</v-row> </v-row>
<!-- <my-helper :pretext="galleryimges.likes.length"/> --> <!-- <my-helper :pretext="galleryimges.likes.length"/> -->
@@ -720,18 +753,16 @@ export default {
} }
const heartIco = () => { const heartIco = () => {
return galleryimges.value.likes.filter(e=>e.user==accountStore.user.login).length==1
let heart =''
if (galleryimges.value.likes.filter(e=>e.user==accountStore.user.login).length==1) {
heart = true
}
else {
heart = false
} }
const heartIcoAll = (image) => {
return image.likes.filter(e=>e.user==accountStore.user.login).length==1
}
return heart const toggleLikeAll = (id) => {
console.log(id, '----------------------');
} }
return { return {
@@ -762,7 +793,9 @@ export default {
galleryimges, galleryimges,
indximg, indximg,
toggleLike, toggleLike,
heartIco heartIco,
toggleLikeAll,
heartIcoAll
} }
@@ -810,5 +843,7 @@ export default {
height: 86vh; height: 86vh;
} }
.place-it{
place-items: center;
}
</style> </style>
+1
View File
@@ -1,5 +1,6 @@
<template> <template>
<v-row> <v-row>
<v-col <v-col
class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light" class="text-h6 text-grey text-center align-self-center text--lighten-1 font-weight-light"
> >