Skip to content

Commit 1655378

Browse files
author
issayah
committed
BCol minor improvement
1 parent 5d08cf7 commit 1655378

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/components/BCol.vue

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
<script lang="ts">
88
import {computed, defineComponent, PropType} from 'vue'
9-
import type {Alignment} from '../types'
10-
import getBreakpointProps from '../utils/getBreakpointProps'
11-
import getClasses from '../utils/getClasses'
9+
import type {Alignment} from '@/types'
10+
import getBreakpointProps from '@/utils/getBreakpointProps'
11+
import getClasses from '@/utils/getClasses'
1212
1313
const breakpointCol = getBreakpointProps('', [], {type: [Boolean, String, Number], default: false})
1414
const breakpointOffset = getBreakpointProps('offset', [''], {type: [String, Number], default: null})
@@ -28,19 +28,15 @@ export default defineComponent({
2828
tag: {type: String, default: 'div'},
2929
},
3030
setup(props) {
31-
let classList: string[] = []
32-
3331
const properties = [
3432
{content: breakpointCol, propPrefix: 'cols', classPrefix: 'col'},
3533
{content: breakpointOffset, propPrefix: 'offset'},
3634
{content: breakpointOrder, propPrefix: 'order'},
3735
]
3836
39-
properties.forEach((property) => {
40-
classList = classList.concat(
41-
getClasses(props, property.content, property.propPrefix, property.classPrefix)
42-
)
43-
})
37+
const classList: Array<string> = properties.flatMap((el) =>
38+
getClasses(props, el.content, el.propPrefix, el.classPrefix)
39+
)
4440
4541
const classes = computed(() => ({
4642
col: props.col || !classList.some((e) => /^col-/.test(e) && !props.cols),

0 commit comments

Comments
 (0)