various-ui
Version:
This is a test version of the Vue 3 component library
36 lines (32 loc) • 1 kB
JavaScript
;
var vue = require('vue');
var index = require('../../default-group/index.js');
const useComposable = (define, emits) => {
const radioGroup = vue.inject(index.UiRadioGroupInjectionKey, void 0);
const computeds = {
//* 选择状态
checked: vue.computed(() => {
if ((radioGroup == null ? void 0 : radioGroup.define.modelValue) == define.value) return true;
else {
return define.modelValue == define.value;
}
}),
//* 标签类名
className: vue.computed(() => {
const result = [];
if (computeds.checked.value) result.push("ui-active");
return result.join(" ");
})
};
const methods = {
switchRatio: (_ev) => {
const el = _ev.target;
emits("update:modelValue", el.value || "");
emits("change", _ev);
radioGroup == null ? void 0 : radioGroup.change(define.value);
}
};
return { computeds, methods };
};
exports.useComposable = useComposable;
//# sourceMappingURL=composable.js.map