Skip to content

Commit ed9a291

Browse files
committed
BsCheckbox, BsRadioGroup: fixed bug column layout didn't respect "column" property when value is set to "1".
1 parent a54f0d9 commit ed9a291

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/components/Radio/mixins/radioApi.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ export function useRenderRadioOrCheckboxGroup<D, M>(
185185
hasError: boolean,
186186
errorItems: Array<string>
187187
): VNode {
188+
const numCols = props.column ? parseInt(props.column as string, 10) : undefined;
189+
188190
return h('div', { class: classnames.value }, [
189191
renderSlot(slots, 'default'),
190192
h('div', { class: 'col' }, [
@@ -197,15 +199,10 @@ export function useRenderRadioOrCheckboxGroup<D, M>(
197199
'row-cols-sm-auto': !props.column && props.items.length < 4,
198200
'row-cols-sm-2': !props.column && props.items.length > 3,
199201
'row-cols-lg-3 row-cols-xl-4': !props.column,
200-
'row-cols-md-2': props.column && props.items.length > 3,
201-
[`row-cols-lg-4`]:
202-
props.column &&
203-
parseInt(props.column as string, 10) > 4 &&
204-
props.items.length > 3,
205-
[`row-cols-lg-${props.column}`]:
206-
props.column && parseInt(props.column as string, 10) < 5,
207-
[`row-cols-xl-${props.column}`]:
208-
props.column && parseInt(props.column as string, 10) > 1,
202+
'row-cols-md-2': numCols && numCols > 1 && props.items.length > 3,
203+
[`row-cols-lg-4`]: numCols && numCols > 4 && props.items.length > 3,
204+
[`row-cols-lg-${props.column}`]: numCols && numCols > 1 && numCols < 5,
205+
[`row-cols-xl-${props.column}`]: numCols && numCols > 1,
209206
},
210207
},
211208
children

0 commit comments

Comments
 (0)