import { Picker as VanPicker, CheckboxGroup as VanCheckboxGroup, Checkbox as VanCheckbox, CellGroup as VanCellGroup, Cell as VanCell } from 'vant' import { computed, ref, onBeforeUpdate } from 'vue' import { useOptions } from '@cip/components/hooks/form-input' import { formInputProps, fromInputEmits } from '../../form-input-props' export default { props: { ...formInputProps, customFieldName: {}, columns: {} }, emits: [...fromInputEmits, 'confirm', 'cancel'], setup (props, { emit }) { // 是否多选 const multiple = computed(() => { return props.config?.multiple ?? false }) const { options, getValue } = useOptions(props, multiple) const confirm = (value) => { if (multiple.value) { emit('confirm', checked.value) } else { if (props.customFieldName.children) { value = value[value.length - 1] } emit('confirm', value) } } const cancel = (val) => { if (multiple.value) { checked.value = getValue(props.modelValue) } emit('cancel', val) } // 多选 console.log('init', getValue(props.modelValue), props.modelValue) const checked = ref(getValue(props.modelValue)) const checkboxRefs = ref([]) const toggle = (index) => { checkboxRefs.value[index]?.toggle() } onBeforeUpdate(() => { checkboxRefs.value = [] }) const Buttons = () =>
const CellSlot = (item, index) =>