tmagic-editor/packages/design/src/CheckboxGroup.vue
2023-05-29 17:37:34 +08:00

39 lines
808 B
Vue

<template>
<component
class="tmagic-design-checkbox-group"
:is="uiComponent.component"
v-bind="uiProps"
@change="changeHandler"
@update:modelValue="updateModelValue"
>
<slot></slot>
</component>
</template>
<script setup lang="ts">
import { computed } from 'vue';
import { getConfig } from './config';
import type { CheckboxGroupProps } from './types';
defineOptions({
name: 'TMCheckboxGroup',
});
const props = defineProps<CheckboxGroupProps>();
const uiComponent = getConfig('components').checkboxGroup;
const uiProps = computed(() => uiComponent.props(props));
const emit = defineEmits(['change', 'update:modelValue']);
const changeHandler = (v: any) => {
emit('change', v);
};
const updateModelValue = (v: any) => {
emit('update:modelValue', v);
};
</script>