Галерея с переключением

This commit is contained in:
iriska-gri committed 2023-12-05 13:14:41 +03:00
1 parent 395b0b9fe3
commit 319608f1a1
19 files changed
+67 -43

No files matched your search

+59 -38
View File
@@ -321,6 +321,7 @@
>
</v-img>
<v-card-text class="pt-6">
<!-- <div class="font-weight-light text-grey text-h6 mb-2">
@@ -496,11 +497,42 @@
height="900"
class="flex-column "
>
<v-card class="pa-4">
<v-btn density="compact" icon="mdi-plus" @click="forgetgallery('plus')"></v-btn>
<v-btn density="compact" icon="mdi-minus" @click="forgetgallery('minus')"></v-btn>
{{imgsrc}}
{{galleryimges}}
<v-card class="pa-4 h-100 flex-column d-flex">
<v-row>
<v-col class="flex-grow-0 align-self-center">
<v-btn
density="compact"
variant="text"
icon="mdi-chevron-left"
@click = "indximg +=1"
/>
</v-col>
<v-col class="bg-green">2</v-col>
<v-col class="d-flex flex-column flex-grow-1">
<v-row class="flex-grow-0">
<v-col class="bg-grey">3</v-col>
<v-col class=" bg-red">5</v-col>
</v-row>
<v-row>
<v-col class="flex-column d-flex align-end align-self-center">
<v-btn
density="compact"
variant="text"
icon="mdi-chevron-right"
@click = "indximg -=1"
/>
</v-col>
</v-row>
</v-col>
</v-row>
<!-- <v-btn density="compact" icon="mdi-plus" @click = "indximg +=1"></v-btn>
</v-btn>
{{indximg}}
{{galleryimges}} -->
<!-- {{cidimg}}
-->
<!-- <v-img
class="d-flex h-100"
@@ -552,18 +584,18 @@ export default {
const newss=ref([])
const galleryimges=ref([])
const dialogCommentShow = ref(false)
const gallery = ref(false)
const dialogfoto = ref(false)
const burl = baseURL.slice(0,-1)
const textcomment = ref('')
const idnews = ref(0)
const page = ref(1)
const selecnews = ref(2)
const route = useRoute()
const imgsrc = ref(1)
let str = `api/navigation/news/?name=${route.path}&page=${page.value-1}&selected=${selecnews.value}`
@@ -602,21 +634,9 @@ export default {
}
const galleryimg = (id) => {
getfromserver(`api/navigation/gallery/?id=${id}`, galleryimges)
}
const openImg = (imgid) => {
console.log(imgid);
imgsrc.value = ''
dialogfoto.value = true
imgsrc.value = imgid
galleryimg(imgid)
}
const addComment = () => {
axiosApiInstance.post(`api/navigation/news/`, {news: idnews.value, text: textcomment.value}).then(result => {
@@ -690,22 +710,25 @@ export default {
return name.familyname + ' ' + name.name[0] + '.' + name.parentname[0]+ '.'
}
const forgetgallery = (hu) => {
if (hu =="plus") {
imgsrc.value += 1
}
else if (imgsrc.value !=0 && hu == "minus") {
imgsrc.value -= 1
}
galleryimg(imgsrc.value)
console.log(imgsrc.value, hu, 'ffffffffffffffffffffffff');
// ------------------------------ Галерея
const galleryimges=ref([])
const dialogfoto = ref(false)
const indximg = ref('')
const openImg = (idimg) => {
dialogfoto.value = true
indximg.value = newss.value.result[0].gallery.findIndex(e=>e.id == idimg)
}
watch(()=>indximg ,(newValue,oldValue)=>{
if(newValue){
galleryimges.value = newss.value.result[0].gallery[newValue.value]
}
}, {deep:true})
return {
newss,
@@ -732,10 +755,8 @@ export default {
gallery,
openImg,
dialogfoto,
imgsrc,
galleryimges,
forgetgallery
indximg
}