yanzhen-design-vue
Version:
43 lines (42 loc) • 1.38 kB
JavaScript
import { ref, useAttrs, useSlots, computed, mergeProps, h } from "vue";
import { RadioGroup } from "ant-design-vue";
import { useModel, useOptions, useProxyProps, unref } from "@yanzhen-libs/utils-vue";
import { AntRadioGroup } from "./radio-group.mjs";
function useRadioGroup(props, emit) {
const _ref = ref();
const attrs = useAttrs();
const $slots = useSlots();
const checkedRef = useModel(props);
const optionsRef = useOptions();
const config = computed(() => props);
const proxyProps = useProxyProps(config, AntRadioGroup.emits, {
emit(event, ...args) {
switch (event) {
case "update:value":
console.log(props, "propspropsprops");
checkedRef.value = args[0];
break;
default:
emit == null ? void 0 : emit(event, ...args);
}
},
exclude: ["value", "onUpdate:value", "options"]
// filter: key => {
// switch (key as string) {
// case 'onUpdate:value':
// return false;
// }
// return true;
// },
});
const propsRef = computed(() => {
return mergeProps(unref(attrs), unref(proxyProps));
});
function createRadioGroupVNode(props2) {
return h(RadioGroup, { ...unref(propsRef), ...props2 }, unref($slots));
}
return [{ _ref, $slots, propsRef, checkedRef, optionsRef }, createRadioGroupVNode];
}
export {
useRadioGroup
};