|
19 | 19 | </router-link> |
20 | 20 | </div> |
21 | 21 | <!-- Main content, section for each group of items --> |
22 | | - <div v-if="checkTheresData(sections) || isEditMode" :class="computedClass"> |
| 22 | + <div v-if="checkTheresData(sections) || isEditMode" :class="computedClass" |
| 23 | + ref="sectionsContainer"> |
23 | 24 | <template v-for="(section, index) in filteredSections"> |
24 | 25 | <Section |
25 | 26 | :key="index" |
|
36 | 37 | @change-modal-visibility="updateModalVisibility" |
37 | 38 | :isWide="!!singleSectionView || layoutOrientation === 'horizontal'" |
38 | 39 | :class="(searchValue && section.filteredItems.length === 0) ? 'no-results' : ''" |
| 40 | + :activeColCount="activeColCount" |
39 | 41 | /> |
40 | 42 | </template> |
41 | 43 | <!-- Show add new section button, in edit mode --> |
@@ -83,6 +85,7 @@ export default { |
83 | 85 | layout: '', |
84 | 86 | itemSizeBound: '', |
85 | 87 | addNewSectionOpen: false, |
| 88 | + activeColCount: 1, |
86 | 89 | }), |
87 | 90 | computed: { |
88 | 91 | singleSectionView() { |
@@ -172,12 +175,26 @@ export default { |
172 | 175 | availibleThemes.Default = '#'; |
173 | 176 | return availibleThemes; |
174 | 177 | }, |
| 178 | + readActiveColCount() { |
| 179 | + const { sectionsContainer } = this.$refs; |
| 180 | + if (!sectionsContainer) return; |
| 181 | + const cs = getComputedStyle(sectionsContainer); |
| 182 | + const varVal = parseInt(cs.getPropertyValue('--col-count'), 10); |
| 183 | + if (!Number.isNaN(varVal) && varVal > 0) { |
| 184 | + this.activeColCount = varVal; |
| 185 | + } |
| 186 | + }, |
175 | 187 | }, |
176 | 188 | mounted() { |
177 | 189 | this.initiateFontAwesome(); |
178 | 190 | this.initiateMaterialDesignIcons(); |
179 | 191 | this.layout = this.layoutOrientation; |
180 | 192 | this.itemSizeBound = this.iconSize; |
| 193 | + this.readActiveColCount(); |
| 194 | + window.addEventListener('resize', this.readActiveColCount); |
| 195 | + }, |
| 196 | + beforeDestroy() { |
| 197 | + window.removeEventListener('resize', this.readActiveColCount); |
181 | 198 | }, |
182 | 199 | }; |
183 | 200 | </script> |
|
0 commit comments