<template>
  <LabelBox
    :label="formItems.attrs?.label"
    :need-star="formItems.attrs?.needStar"
    :width="formItems.attrs?.width"
  >
    <el-checkbox-group
      v-model="value"
      class="checkbox"
      size="mini"
      :value="value"
      v-on="formItems.events"
      @change="handleChangeEvent($event)"
    >
      <el-checkbox
        v-for="(options, i) in formItems.options"
        :key="i"
        :label="options.label"
      >
        {{ options.value }}
      </el-checkbox>
    </el-checkbox-group>
  </LabelBox>
</template>

<script>
import LabelBox from '../labelBox/index.vue';
import fieldMixin from '../fieldMixin';

export default {
  components: {
    LabelBox,
  },
  mixins: [fieldMixin],
  props: {
    formItems: {
      type: Object,
      default: () => {},
    },
    value: {
      type: Array,
      default: () => [],
    },
  },
};
</script>
<style lang="scss" scoped>
.checkbox {
  min-height: 28px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}
::v-deep.el-checkbox .el-checkbox__label {
  font-size: 12px;
}
</style>

