Hopefully this makes sense. I'll change things as requested if I'm missing something crucial.
I have a component where the items of my array are displayed here within cards.
<b-card-group deck class="mb-3">
<b-card border-variant="danger" bg-variant="dark" text-variant="white" class="text-center" v-for="b in breakdownNumbers" :key="b"> {{b}}
</b-card>
</b-card-group>
That array is on another component here
data() {
return {
bns: []
}
}
methods: {
addBns (bns) {
for (var b of bns) {
if(this.bns.indexOf(b) === -1) {
this.bns.push(b)
}
}
},
So here's my issue. Of course if there are 30 items added then 30 cards will be displayed across my form. What I need to do and don't know where to start is have only 5 cards displayed per row rather than continue to add cards to the same row for however many breakdownNumbers
there are causing the cards to just keep shrinking.
Is there a simple way to do this?
This is how it looks now with 5 items added. So when someone clicks New Breakdown
I want it to start on the next row below the 5 already added to the array bns:[]
Ok so now I have:
methods: {
addBns (bns) {
for (var b of bns) {
if(this.bns.indexOf(b) === -1) {
this.bns.push(b)
}
}
var bns = _.chunk(bns,3)
console.log(bns)
},
I can see the split in the console. I'm not sure what to do from here. I still have the array being sent to the display component
<build-breakdown-select :buildNumber="buildNumber" :breakdownNumbers="bns" @breakdowns="addBns"/>
And then <build-breakdown-select>
houses the cards.