| 1 |
<template> |
| 2 |
<ElCheckboxGroup |
| 3 |
v-model="localModelValue" |
| 4 |
class="ivyforms-checkbox-group" |
| 5 |
v-bind="{ ...$props, ...$attrs }" |
| 6 |
@change="(eventValue: CheckboxValueType[]) => $emit('change', eventValue)" |
| 7 |
> |
| 8 |
<slot /> |
| 9 |
</ElCheckboxGroup> |
| 10 |
</template> |
| 11 |
|
| 12 |
<script setup lang="ts"> |
| 13 |
import type { CheckboxGroupValueType, CheckboxValueType } from 'element-plus' |
| 14 |
import { computed } from 'vue' |
| 15 |
|
| 16 |
const props = defineProps<{ |
| 17 |
modelValue?: CheckboxGroupValueType | undefined |
| 18 |
}>() |
| 19 |
|
| 20 |
const emit = defineEmits(['update:modelValue', 'change']) |
| 21 |
|
| 22 |
const localModelValue = computed({ |
| 23 |
get() { |
| 24 |
return props.modelValue |
| 25 |
}, |
| 26 |
set(value) { |
| 27 |
emit('update:modelValue', value) |
| 28 |
}, |
| 29 |
}) |
| 30 |
</script> |
| 31 |
|
| 32 |
<style lang="scss"> |
| 33 |
@use 'sass:list' as *; |
| 34 |
@use 'sass:meta' as *; |
| 35 |
// Checkbox Group |
| 36 |
.ivyforms-checkbox-group { |
| 37 |
display: flex; |
| 38 |
gap: 8px; |
| 39 |
flex-direction: column; |
| 40 |
} |
| 41 |
</style> |
| 42 |
|