This commit is contained in:
Surya Paolo
2024-10-23 01:41:24 +02:00
parent 1491484095
commit 76b51f5b91
13 changed files with 255 additions and 137 deletions

View File

@@ -125,6 +125,24 @@ export default defineComponent({
const isAppRunning = computed(() => globalStore.isAppRunning)
const currentCardsPerSlide = computed(() => {
if ($q.screen.lt.sm) return 1
if ($q.screen.lt.md) return 2
return myel.value.num2 ? myel.value.num2 : 2! // cardsPerSlide
})
// Raggruppa le card in base al numero di card per slide
const cardGroups = computed(() => {
const cards = myel.value.listcards || []
const groups = []
for (let i = 0; i < cards.length; i += currentCardsPerSlide.value) {
groups.push(cards.slice(i, i + currentCardsPerSlide.value))
}
return groups
})
const coordaddr = ref(<ICoordGPS>{ address: '', coordinates: [0, 0] })
const carouselRef = ref(<any>null)
@@ -259,6 +277,12 @@ export default defineComponent({
}
// Classe per le colonne delle card
function cardColumnClass() {
const width = 12 / currentCardsPerSlide.value
return `col-xs-12 col-sm-6 col-md-${width}`
}
onMounted(mounted)
return {
@@ -296,6 +320,9 @@ export default defineComponent({
isAtEnd,
activeIndex,
carouselRef,
cardColumnClass,
cardGroups,
currentCardsPerSlide,
}
},