- Card
This commit is contained in:
@@ -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,
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user