antd check box (a-checkbox-group) arranged vertically

1. Introduction to the scene

The Checkbox group is displayed horizontally by default, and the requirement is to change it to vertical display.
insert image description here

2. Solutions

fill in a codestyle="display: grid;"

3. Effect display

insert image description here

4. Complete code

<template>
  <div>
    <a-checkbox-group
      v-model="value"
      name="checkboxgroup"
      :options="plainOptions"
      style="display: grid;"
    />
  </div>
</template>

<script>
export default {
    
    
  data() {
    
    
    return {
    
    
      value: [],
      plainOptions: ['Apple', 'Pear', 'Orange'],
    }
  }
}
</script>

5. Analysis

  • The grid
    element behaves like a block-level element and lays out its content according to the grid model .

Guess you like

Origin blog.csdn.net/qq_45325810/article/details/129362630